Input

A text input component with support for variants, sizes, addons, and element decorations.

Anatomy

<script>
  import {
    Input,
    InputAddon,
    InputGroup,
    InputElement,
  } from "@saas-ui/svelte/components/input";
</script>

<Input placeholder="Enter text..." variant="outline" size="md" />

<!-- With addons and elements -->
<Input.Group>
  <Input.Addon>https://</Input.Addon>
  <Input placeholder="example.com" />
  <Input.Element placement="right">
    <Icon as={SearchIcon} />
  </Input.Element>
</Input.Group>

Examples

Basic Accessibility

Basic input with default styling.

Colours Accessibility

Use the colour prop to change the colour of the input.

Disabled Accessibility

Use the disabled prop to disable the input.

Input With Placeholder Style Accessibility

Input with custom placeholder styling.

Left And Right Element Accessibility

Input with both left and right Input.Element components.

Left Element Accessibility

Input with a left Input.Element (icon or text).

Sizes Accessibility

Use the size prop to change the size of the input. Available sizes: xs, sm, md, lg.

Variants Accessibility

Use the variant prop to change the visual style of the input. Available variants: outline, subtle, flushed.

With Addons Accessibility

Input with Input.Addon elements.

Props

Prop Type Default Description
variant outline | subtle | flushed solid The visual style of the component.
size xs | sm | md | lg md The size of the component.
colour accent | gray | zinc | neutral | stone | slate | red | orange | amber | yellow | lime | green | emerald | teal | cyan | sky | blue | indigo | violet | purple | fuchsia | pink | rose gray The colour theme of the component.
invalid boolean false Whether the component is in an invalid state.
disabled boolean false Whether the component is disabled.
placeholder text - -
class text - Additional CSS classes to apply.