IftaLabel
The label lives inside.
About
Text field with the label inside the border, small and uppercase, above the value: the in-field top-aligned pattern for dense record editors. Form-associated: it posts name=value and binds to React, Vue (v-model) and Angular forms.
Usage
Basic
The small uppercase label sits inside the border above the value. It is a real label bound to the input, and a click anywhere in the box focuses the field.
States
The in-field label is the field label, so help and error render on the shared lines below. The error line carries role="alert".
In a form
Each field posts one entry under its host name. A disabled field posts nothing, and Reset restores the value each field mounted with.
Events
suiInput fires on every keystroke, suiChange on commit at blur or Enter. Both carry the current value as the detail. suiFocus and suiBlur follow the input.
Keyboard
| Key | Action |
|---|---|
| Tab | Moves to the field and on to the next control; the host itself takes no tab stop. |
| Printable characters | Type into the native input; suiInput fires on every keystroke. |
| Enter | Submits the surrounding form, as a native input does. |
API
<sui-ifta-label>
Properties
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
disabled | disabled | boolean | false | Disables the field. |
error | error | stringstring | undefined | Error message on the shared line under the box; paints the field in the danger tone and sets aria-invalid. | |
help | help | stringstring | undefined | Help text on the shared line under the box. Replaced by error when set. | |
invalid | invalid | boolean | false | Danger border. |
label* | label | string | The in-field label. It names the field; only without one does the host's aria-label or aria-labelledby, the rule every text field shares. | |
maxLength | maxlength | numbernumber | undefined | Maximum number of characters, as the native maxlength. | |
minLength | minlength | numbernumber | undefined | Native minlength: a value shorter than this, once the user has typed, fails as tooShort. | |
name | name | stringstring | undefined | Form control name. Reflected: form entry construction reads the content attribute, while all three framework bindings set properties, so an unreflected name posts nothing at all. | |
pattern | pattern | stringstring | undefined | Native pattern: a regular expression the whole value must match. The browser checks it and the field reports patternMismatch on its validity, the way required reports valueMissing. | |
placeholder | placeholder | stringstring | undefined | Placeholder shown under the micro-label while the field is empty. | |
readOnly | readonly | boolean | false | Display only: the text can be selected and copied but not edited; the field still posts its value. |
required | required | boolean | false | Marks the field required (valueMissing validity when empty). |
type | type | SuiInputType"email" | "password" | "search" | "tel" | "text" | "url" | 'text' | Native input type. One union across the four elements that wrap a native text input. |
value | value | string | '' | Current value. Mutable; listen to suiInput / suiChange to observe edits. |
Events
| Event | Detail | React | Vue | Description |
|---|---|---|---|---|
suiBlur | void | onSuiBlur | @sui-blur | Fires when the input loses focus; no detail. Does not bubble. |
suiChange | string | onSuiChange | @sui-change | Fires on commit (blur or Enter, native change); detail is the final value. |
suiFocus | void | onSuiFocus | @sui-focus | Fires when the input takes focus; no detail. The same pair is on every text field. Does not bubble. |
suiInput | string | onSuiInput | @sui-input | Fires on every keystroke; detail is the current value. |
Methods
| Method | Signature | Description |
|---|---|---|
select() | select() => Promise<void> | Selects the field text. |
setFocus() | setFocus() => Promise<void> | Moves keyboard focus into the field. |
Types
SuiInputType typeThe native type values the text-input skin draws. One union for the whole family: the four elements that wrap a native text input each listed a different subset in prose, which read as a rule and was not one. Anything outside this set has its own element (sui-input-number, sui-date-picker, sui-color-picker) or its own skin. | |||
|---|---|---|---|
| No members. |
Theming
Every design token this element can render with, read from its own stylesheets and the ones it imports. Set a token on :root or on any ancestor and every use below follows it. The values shown are the ones in the theme you are viewing. The list is read per stylesheet, so an element that imports a shared drawing module lists that module's tokens too, whether or not it paints with all of them.
Color12
Typography1
Spacing and size4
Radius1
Motion2
Every name above is listed with its value and its role in Foundations.