Text field
A text field is an input that allows a user to write or edit text.Installation
| Install | yarn add @atlaskit/textfield |
|---|---|
| Source | Bitbucket.org, (opens new window) |
| npm | @atlaskit/textfield, (opens new window) |
| Bundle | unpkg.com, (opens new window) |
Props
Text field props
| Description | Controls the appearance of the field. Subtle shows styling on hover. None prevents all field styling. Take care when using the none appearance as this doesn't include accessible interactions. |
|---|---|
| Type | "subtle" | "standard" | "none" |
| Description | Class name to apply to the input element. |
|---|---|
| Type | string |
| Description | Element after input in text field. |
|---|---|
| Type | string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal |
| Description | Element before input in text field. |
|---|---|
| Type | string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal |
| Description | Applies compact styling, making the field smaller. |
|---|---|
| Type | boolean |
| Description | Sets the field as to appear disabled, people will not be able to interact with the text field and it won't appear in the focus order. Wherever possible, prefer using validation and error messaging over disabled fields for a more accessible experience. |
|---|---|
| Type | boolean |
| Description | Changes the text field to have a border indicating that its value is invalid. |
|---|---|
| Type | boolean |
| Description | Sets content text value to appear monospaced. |
|---|---|
| Type | boolean |
| Description | If true, prevents the value of the input from being edited. |
|---|---|
| Type | boolean |
| Description | Set required for form that the field is part of. |
|---|---|
| Type | boolean |
| Description | Name of the input element. |
|---|---|
| Type | string |
| Description | Handler called when the inputs value changes. |
|---|---|
| Type | (event: FormEvent<HTMLInputElement>) => void |
| Description | Handler called when the mouse down event is triggered on the input element. |
|---|---|
| Type | (event: MouseEvent<HTMLElement, globalThis.MouseEvent>) => void |
| Description | Placeholder text to display in the text field whenever it is empty. |
|---|---|
| Type | string |
| Description | Allows getting a ref to the component instance.
Once the component unmounts, React will set @see {@link https://react.dev/learn/referencing-values-with-refs#refs-and-the-dom React Docs} |
|---|---|
| Type | string | Ref<unknown> |
| Description | A |
|---|---|
| Type | string |
| Description | Sets maximum width of input. |
|---|---|
| Type | string | number |
HTML Input props
@atlaskit/textfield extends HTML Input, (opens new window) and supports the props that a nativeinput, (opens new window) element supports. The prop disabled is not supported, please use isDisabled instead.
Useful HTML input props
| Description | No description. |
|---|---|
| Type | string |