GitHubGitHub
← All components
Forms / component

Text input

A text input with prefix/suffix snippets, sizes, and an invalid state.

DefaultInvalidDisabledWith affixes
<TextInput bind:value type="email" placeholder="ana@example.com" />

Installation

pnpm add @chanrg/4ui

Import the stylesheet once, at the root of your app:

import '@chanrg/4ui/styles.css';

Usage

import { TextInput } from '@chanrg/4ui';<TextInput bind:value type="email" placeholder="ana@example.com" />

API reference

Props

PropTypeDefaultDescription
valuestring ($bindable)''Input value.
typetext | email | password | number | search | url | teltextInput type.
sizesm | md | lgmdControl height.
invalidbooleanfalseError styling + aria-invalid.
prefix / suffixSnippetLeading/trailing adornments (icons, units).

CSS variables

VariableDescription
--4ui-surfacePrimary component surface.
--4ui-textPrimary foreground color.
--4ui-borderDefault control and panel border.

Accessibility

  • Composes with Field for label/description/error wiring via the id snippet.

Dependencies

No runtime component dependencies.