Input

Component used to get user input in a text field

  • Name@spark-ui/input
    Version1.4.22
    LicenseMIT
    npmgithubReported IssuesReport a bug
  • Input#

    Input component is a component that is used to get user input in a text field.

    AttributeTypeDescriptionDefault
    asChildboolean-{"value":false}
    onValueChange(value: string) => void-null

    InputGroup#

    Use this wrapper whenever you need a more complex text input. For example if you need to have leading/trailing icons or addons.

    AttributeTypeDescriptionDefault
    state"alert" | "error" | "success"-null
    onClear() => void-null
    disabledboolean-null
    readOnlyboolean-null

    InputGroup.LeadingAddon#

    Add any type of component that will be displayed before the input field.

    This provides flexibility to include additional elements, such as buttons or dropdowns, to enhance the user interface and provide clear context or guidance to the user.

    AttributeTypeDescriptionDefault
    readOnlyboolean-null
    asChildboolean-null
    design"text" | "inline" | "solid"-null

    InputGroup.TrailingAddon#

    Add any type of component that will be displayed after the input field.

    This provides flexibility to include additional elements, such as buttons or dropdowns, to enhance the user interface and provide clear context or guidance to the user.

    AttributeTypeDescriptionDefault
    readOnlyboolean-null
    asChildboolean-null
    design"text" | "inline" | "solid"-null

    InputGroup.LeadingIcon#

    Prepend a decorative icon inside the input (to the left).

    AttributeTypeDescriptionDefault
    children*ReactNodeThe svg icon that will be wrappednull
    labelstringThe accessible label for the icon. This label will be visually hidden but announced to screen reader users, similar to `alt` text for `img` tags.null
    size"current" | "sm" | "md" | "lg" | "xl"-null
    intent"main" | "alert" | "neutral" | "error" | "success" | "current" | "support" | "accent" | "basic" | "info"-null

    InputGroup.TrailingIcon#

    Append a decorative icon inside the input (to the right).

    This element will be replaced by a status indicator whenever the input is in error/alert/success state.

    AttributeTypeDescriptionDefault
    children*ReactNodeThe svg icon that will be wrappednull
    labelstringThe accessible label for the icon. This label will be visually hidden but announced to screen reader users, similar to `alt` text for `img` tags.null
    size"current" | "sm" | "md" | "lg" | "xl"-null
    intent"main" | "alert" | "neutral" | "error" | "success" | "current" | "support" | "accent" | "basic" | "info"-null

    InputGroup.ClearButton#

    Clears the input value. Only for search inputs. This button will be shown when the user has typed something in the input.

    AttributeTypeDescriptionDefault
    aria-label*stringDefines a string value that labels the current element.null