Skip to content

    Browse components

    Interactive Input

    A text field with a floating label, a focus ring that blooms out of the border, a spring-in clear button, a character-count ring and a shake on error.

    Open
    Customize

    Installation

    npx shadcn@latest add @glint-ui/interactive-input

    First time using @glint-ui? Add the registry to components.json once, or install by URL: npx shadcn@latest add https://glintui.vercel.app/r/interactive-input.json

    Usage

    import { InteractiveInput } from "@/components/ui/interactive-input";
    
    const [name, setName] = useState("");
    
    <InteractiveInput
      label="Username"
      maxLength={20}
      value={name}
      onValueChange={setName}
      error={name === "admin" ? "That username is taken." : undefined}
    />

    Props

    PropTypeDefaultDescription
    labelstring"Username"Floating label.
    placeholderstring"ada_lovelace"Shown only while focused and empty.
    hintstring"Letters, numbers and underscores."Helper text under the field.
    errorstring""Error message. Setting it turns the field red and shakes it.
    maxLengthnumber20Max characters, drives the counter ring.
    showCounterbooleantrueShow the used / max counter.
    clearablebooleantrueShow a clear button when filled.
    disabledbooleanfalseDisable the field.
    iconReactNode—Leading icon.
    valueReactNode—Controlled value; pair with `onValueChange(value)`. Or use `defaultValue`. Native input props are forwarded.
    classNamestring—Extra classes for the root element.