Input

Through mouse or keyboard input content, it is the most basic form field wrapper.
Import

When To Use#

  • A user input in a form field is needed.
  • A search input is required.

Examples#

Basic usage example.

      Loading...
    

Variants of Input, there are four variants: outlined, filled, borderless and underlined.

      Loading...
    
20.0.0




https://



Zhejiang

Use <nz-space-compact> create compact style, See the documentation for more.

      Loading...
    
20.4.0




Search loading when onSearch.

      Loading...
    
20.4.0

nzAutosize prop for a textarea type of nz-input makes the height to automatically adjust based on the content. An options object can be provided to nzAutosize to specify the minimum and maximum number of lines the textarea will automatically adjust.

      Loading...
    

You can use the Input in conjunction with Tooltip component to create a Numeric Input, which can provide a good experience for extra-long content display.

      Loading...
    





Input type of password.

      Loading...
    
20.4.0

Show character count.

      Loading...
    




There are three sizes of an Input box: large (40px)、default (32px) and small (24px).

      Loading...
    
http://.com

Http://.com



http://.com

cascader

Using pre & post tabs example.

      Loading...
    




https://





Example of creating a search box by grouping a standard input with a search button.

      Loading...
    
20.4.0

For multi-line input.

      Loading...
    
With Formatter (Uppercase)
With Disabled
With Length (8)
With custom display character

One time password input.

      Loading...
    


¥RMB

¥RMB

Add prefix or suffix icons inside input.

      Loading...
    




Input with clear icon.

      Loading...
    
20.4.0

Add status to Input with nzStatus, which could be error or warning.

      Loading...
    

API#

[nz-input]#

All props of input supported by w3c standards and Angular can used in [nz-input].

PropertyDescriptionTypeDefaultVersion
[nzSize]The size of the input box. Note: in the context of a form, the large size is used.'large' | 'small' | 'default''default'
[nzAutosize]Only used for textarea, height autosize feature, can be set to boolean or an object { minRows: 2, maxRows: 6 }boolean | { minRows: number, maxRows: number }false
[nzBorderless]Whether hide borderbooleanfalse
[nzVariant]Variants of Input'outlined' | 'borderless' | 'filled' | 'underlined''outlined'20.0.0
[nzStatus]Set validation status'error' | 'warning'-
[nzStepperless]Whether hide stepper when input type is numberbooleantrue

nz-input-wrapper#

Use when you need to add extra functionality to [nz-input].

PropertyDescriptionTypeDefault
[nzAddonBefore]The label text displayed before (on the left side of) the input fieldstring-
[nzAddonAfter]The label text displayed after (on the right side of) the input fieldstring-
[nzPrefix]The prefix icon for the Inputstring-
[nzSuffix]The suffix icon for the Inputstring-
[nzAllowClear]If allow to remove input content with clear iconbooleanfalse
(nzClear)Event emitted when the clear icon is clickedOutputEmitterRef<void>-

nz-input-password#

All properties of nz-input-wrapper can be used.

PropertyDescriptionTypeDefault
[nzVisibilityToggle]Whether to show the toggle buttonbooleantrue
[nzVisible]Whether the password is visible, supports two-way bindingbooleanfalse
(nzVisibleChange)Event emitted when the visibility of the password changesOutputEmitterRef<boolean>-

All properties of nz-input-wrapper can be used.

PropertyDescriptionTypeDefault
[nzEnterButton]false displays the default button color, true uses the primary color, or you can provide a custom button. Conflicts with nzAddonAfter.boolean | stringfalse
[nzLoading]Search box with loadingbooleanfalse
(nzSearch)The event triggered when you click on the search-icon, the clear-icon or press the Enter key{ value: string, event: Event, source: 'clear' | 'input' }

nz-input-group#

⚠️ nz-input-group has been deprecated in v20.0.0 and will be removed in v22.0.0. Please use the nz-input-wrapper component instead.

PropertyDescriptionTypeDefault
[nzAddOnAfter]The label text displayed after (on the right side of) the input field, can work with nzAddOnBeforestring | TemplateRef<void>-
[nzAddOnBefore]The label text displayed before (on the left side of) the input field, can work with nzAddOnAfterstring | TemplateRef<void>-
[nzPrefix]The prefix icon for the Input, can work with nzSuffixstring | TemplateRef<void>-
[nzSuffix]The suffix icon for the Input, can work with nzPrefixstring | TemplateRef<void>-
[nzSize]The size of nz-input-group specifies the size of the included nz-input fields'large' | 'small' | 'default''default'
[nzStatus]Set validation status'error' | 'warning'-

nz-textarea-count#

PropertyDescriptionTypeDefault
[nzMaxCharacterCount]textarea maximum character count displayednumber-
[nzComputeCharacterCount]customized characterCount computation function(v: string) => numberv => v.length

nz-input-otp#

PropertyDescriptionTypeDefault
[disabled]Whether the input is disabledbooleanfalse
[nzFormatter]Format display, blank fields will be filled with (value: string) => string-
[nzMask]Custom display, the original value will not be modifiedboolean | nullnull
[nzLength]The number of input elementsnumber6
[nzStatus]Set validation status'error' | 'warning'-
[nzSize]The size of the input box'large' | 'small' | 'default''default'

Q&A#

How to use compact input group?#

nz-input-group is no longer support compact mode directly in v20, you can use nz-space-compact instead.