Web · Components
Input
Single-line text input.
Live example
Preview
Code
Events
- Events appear here when you interact with the preview.
Appearances: outline, filled, underline, ghost
Whole section: data-field-variant="filled" (its own variant wins)
Preview
Code
Events
- Events appear here when you interact with the preview.
Ready-made masks (the ones with checksums error on wrong values)
Floating label: appearance × position
Tek yerden: <UIProvider floatingLabel> ve odak rengi (--ui-field-focus)
Custom patterns and custom letters
applyMask: format a stored value in a list
- 05321234567 → 0 (532) 123 45 67
- 02161234567 → 0 (216) 123 45 67
- 5551112233 → 0 (555) 111 22 33
Import
Single-line text input. Supports all native <input> props. Give aria-invalid for invalid fields; they show with a red border.
For the right keyboard on mobile use a fitting type and inputMode (e.g. type="email", inputMode="numeric", type="tel") and enable autofill with autoComplete.
mask: patterned input such as phone, plate, IBAN (seeMaskProp).label: a floating label; inside when empty, on top when typing.
Examples
fieldVariants
constantShared look of text fields. Used by Input and Textarea.
Mobile behavior: The font size is 16 px on small screens. iOS Safari zooms the page automatically when focusing fields with text smaller than 16 px; this prevents that zoom. It drops to 14 px on wide screens.
The style (filled, underline, ghost) is chosen with the data-field-variant attribute, not classes; see FieldVariant.
MASK_TOKENS
constantBuilt-in pattern letters.
MASK_PRESETS
constantBuilt-in mask definitions. You can derive your own masks from these.
applyMask
functionFormats text with a mask. Also useful outside components: showing a stored unmasked value in a list, validating on the server, etc. Also runs on the server.
Examples
FieldVariant
typeAppearance of a form field. Input, Textarea, Select, Autocomplete, TagInput, NumberInput, DatePicker, TimePicker, ColorPicker and RichTextEditor take it via the variant prop; the *Field wrappers pass the same prop through.
outline: bordered, background same as the page (default).filled: borderless, light gray fill; lightens on focus. Calmer on the eye in dense forms and on mobile.underline: only a bottom line; the line darkens on focus. For plain, "paper"-looking forms and inline editing.ghost: borderless and unfilled; appears on hover or focus. For places like toolbars, table cells and title editing.
Page or section-wide default: Give any container data-field-variant="filled"; all fields inside take that appearance. <body data-field-variant="filled"> in the root layout changes the whole app. It is CSS only; it works in server components too and needs no JavaScript or provider. The field's own variant prop always wins; in nested containers the nearest one applies.
From UIProvider: appearance.defaults.field is the default variant and effect of all fields; appearance.variants.field adds your own styles (string: classes, based on outline; object: { extends: "filled", className }). The field's own prop still wins.
Focus look: No ring is drawn outside the focused field (so it doesn't cover a floating label on the top border); the border thickens inward by 2 px and gets colored. The space the field takes doesn't change. The color is chosen with the --ui-field-focus CSS variable (the primary color by default); it can be set for a theme, page, section or single field:
Examples
InputProps
interfaceProps of the Input component.
Extends: ComponentProps<"input">
| Name | Type | Default | Description |
|---|---|---|---|
icon? | IconProp | Icon at the start of the field: a name ("search") or an element. | |
iconEnd? | IconProp | Icon or small content at the end of the field (e.g. a unit, "TL"). | |
variant? | FieldVariant | CustomVariant<"field"> | Appearance: outline (bordered), filled, underline or ghost (plain). If omitted, the setting of the nearest data-field-variant container is used, or outline if there is none. See FieldVariant. | |
effect? | EffectProp | Effect or effects of the field box (e.g. "glow", ["lift", "beam"]). The accent color is the focus color (--ui-field-focus). If omitted, UIProvider appearance.defaults.field.effect. See BuiltinEffect. | |
label? | ReactNode | Floating label. While the field is empty it sits inside the field like a placeholder; on focus or when the field is filled it shrinks and moves up. It is linked to the field automatically (the accessible name comes from it); if id is omitted, one is generated. The placeholder (placeholder) is visible only while the label is up. Where it lifts to is chosen with floatingLabel. In a form, use TextField floatingLabel together with a label, description and error message. | |
floatingLabel? | FloatingLabel | true | Position of the floating label: true (by appearance; default), "border" (on the top line) or "inside" (at the top inside the box). false disables the floating label. See FloatingLabel. |
mask? | MaskProp | Input mask: formats what is typed by a pattern (phone, plate, IBAN…). Give a preset name ("phone", "plate", "iban", "tckn", "card", "date"…), a pattern ("(999) 999 99 99") or a detailed definition. See MaskProp. - Formatted while typing, pasting and on autofill; separators are added automatically and the caret stays in place. - The mobile keyboard is chosen by the pattern (numeric keyboard for a digit pattern). - When empty, the placeholder is generated from the pattern (0 (___) ___ __ __). - An incomplete value (maskIncomplete) or a checksum-failing value (maskInvalid, e.g. a wrong IBAN) doesn't submit the form; inside TextField the message appears under the field. value/defaultValue can be given with or without separators. The component runs on the client; an Input without a mask stays a server component. | |
onValueChange? | (value: string, details: MaskResult) => void | Only with mask: called with the formatted text and details (unmasked, complete, valid) when the value changes. See MaskResult. | |
unmask? | boolean | false | Only with mask: the form submits the value without separators (05321234567 instead of 0 (532) 123 45 67). The field shows the formatted text. |
reveal? | PasswordRevealMode | false | "hold" | Only for type="password": the eye button at the end of the field. - "hold": the password shows while held and hides on release (hold Space/Enter on the keyboard). - "toggle": each press toggles between show/hide. It hides automatically when the form is submitted. - false: no button (e.g. fields like a PIN that nobody should see). Pressing the button doesn't take focus from the field; the keyboard doesn't close on mobile. Button texts are changed in the dictionary's ui namespace (showPassword, hidePassword, holdToShowPassword; see UIProvider messages). |
FloatingLabel
typePosition of the floating label. See InputProps.floatingLabel.
true: chosen by appearance: on the line (border) foroutlinefields, inside the box (inside) forfilled,underlineandghostfields. It also follows the page-widedata-field-variantsetting."border": sits on the top border; the border is cut behind the label. The field height doesn't change."inside": shrinks to the top inside the box; the field gets a bit taller (48 px).false: no floating label.
MaskToken
interfaceWhich characters a letter in a mask pattern accepts.
| Name | Type | Description |
|---|---|---|
test | RegExp | Regular expression that tests a single character. When transform is set, the transformed character is tested. |
transform? | (char: string) => string | Transforms the character before accepting it (e.g. to uppercase). |
Examples
MaskPreset
typeBuilt-in masks. Each brings the pattern, the mobile keyboard type (inputMode), the autofill hint and, where needed, checksum validation.
phone: Turkish phone number,0 (532) 123 45 67. Same result whether or not the leading 0 is typed.phoneIntl: Turkish phone number in international format,+90 (532) 123 45 67.plate: Turkish license plate,34 ABC 123. Letters are uppercased; the province code (01–81) and the letter/digit count rule are checked.tckn: Turkish national ID number, 11 digits; validated with the official algorithm.taxNumber: Turkish tax ID number (VKN), 10 digits.iban: Turkish IBAN,TR12 3456 …; validated with the mod-97 checksum.card: Credit card,1234 5678 9012 3456; validated with Luhn.expiry: Card expiry date,MM/YY.date: Date,DD.MM.YYYY; checked to be a real day.time: Time,HH:MM(00:00–23:59).postalCode: Postal code, 5 digits.
MaskOptions
interfaceDetailed mask definition. See MaskProp.
| Name | Type | Description |
|---|---|---|
pattern | string | readonly string[] | Pattern or patterns. With an array, the pattern that best fits the input is used (e.g. different formats for landlines and mobiles). See MaskProp. |
tokens? | Record<string, MaskToken> | Additional or overridden letters to use in the pattern. |
validate? | (unmasked: string, formatted: string) => boolean | Called when the value is complete; returning false marks the field invalid (customError) and shows invalidMessage. Receives the value without separators (see MaskResult.unmasked). |
invalidMessage? | string | Message shown when validate fails. Defaults to the maskInvalid text in the dictionary. |
placeholder? | string | Placeholder shown while the field is empty. Generated from the pattern by default ((___) ___). |
inputMode? | "text" | "numeric" | "tel" | "decimal" | Mobile keyboard. Defaults to numeric when the pattern only asks for digits. |
autoComplete? | string | Browser autofill hint (e.g. tel-national). |
MaskProp
typeMask of a field. Given in three forms:
- Built-in mask name (
MaskPreset):"phone","plate","iban"… - Pattern (or an array of patterns): the letters below stand for a character the user types; everything else is a literal that is inserted automatically.
9: digita: letter (including Turkish letters)A: letter, converted to uppercase*: letter or digitX: letter or digit, converted to uppercase{n}/{n,m}/{n,}: how many times the previous letter repeats (e.g.A{1,3}is 1–3 letters). In a variable-length section, type the separator (e.g. a space) to move to the next section, or just type a character of the next kind.\: makes the next character a literal (\9→ "9").- Detailed definition (
MaskOptions): custom letters, validation, placeholder, keyboard type.
Examples
MaskResult
interfaceResult of applyMask.
| Name | Type | Description |
|---|---|---|
value | string | Formatted text (shown in the field). |
unmasked | string | Value without separators: the typed characters and letter/digit literals of the pattern (0 (532) 123 45 67 → "05321234567", 34 ABC 123 → "34ABC123"). |
complete | boolean | Are all required sections of the pattern filled? false for an empty value. |
valid | boolean | Does the complete value pass the mask's validation? Same as complete for masks without validation. |
How the show/hide password button works. See InputProps.reveal.