Input

A text input component with prefix/suffix slots, feedback color states, and size variants that share the same sizing system as the button component.

Feedback

Apply semantic feedback colors to indicate validation state or context.

---
import Input from "../Input.astro";
import { stack } from "@pindoba/styled-system/patterns";
---

<div class={stack({ gap: "md", direction: "column" })}>
  <Input feedback="neutral" placeholder="Neutral" />
  <Input feedback="primary" placeholder="Primary" />
  <Input feedback="success" placeholder="Success" />
  <Input feedback="danger" placeholder="Danger" />
  <Input feedback="warning" placeholder="Warning" />
</div>

Size

Inputs come in four sizes that share the same height system as buttons.

---
import Input from "../Input.astro";
import { stack } from "@pindoba/styled-system/patterns";
---

<div class={stack({ gap: "md", direction: "column" })}>
  <Input size="xs" placeholder="Extra Small" />
  <Input size="sm" placeholder="Small" />
  <Input size="md" placeholder="Medium" />
  <Input size="lg" placeholder="Large" />
</div>

Prefix & Suffix

Use fieldPrefix and fieldSuffix slots to add icons, labels, or controls inside the input wrapper.

🔍
$
USD
---
import Input from "../Input.astro";
import { stack } from "@pindoba/styled-system/patterns";
import { css } from "@pindoba/styled-system/css";
---

<div class={stack({ gap: "md", direction: "column" })}>
  <Input placeholder="Search...">
    <span
      slot="fieldPrefix"
      class={css({ px: "xs", color: "neutral.text.muted" })}>🔍</span
    >
  </Input>

  <Input placeholder="Enter amount">
    <span
      slot="fieldPrefix"
      class={css({ px: "xs", color: "neutral.text.muted" })}>$</span
    >
    <span
      slot="fieldSuffix"
      class={css({ px: "xs", color: "neutral.text.muted" })}>USD</span
    >
  </Input>
</div>

Custom Styling

The passThrough prop provides escape hatches for each slot: style accepts a Panda CSS SystemStyleObject and props forwards arbitrary HTML attributes.

Custom style via passThrough

Custom props via passThrough

---
import Input from "../Input.astro";
import { stack } from "@pindoba/styled-system/patterns";
---

<div class={stack({ gap: "xl", direction: "column" })}>
  <div>
    <h3>Custom style via passThrough</h3>
    <Input
      placeholder="Custom root style"
      passThrough={{
        root: { style: { borderRadius: "full" } },
        input: { style: { fontStyle: "italic" } },
      }}
    />
  </div>

  <div>
    <h3>Custom props via passThrough</h3>
    <Input
      placeholder="Search..."
      passThrough={{
        input: {
          props: {
            "aria-label": "Search input",
            "data-testid": "search-input",
          },
        },
      }}
    />
  </div>
</div>

Props

Prop
feedback
feedback

Semantic feedback color scheme. neutral: Default. primary: Primary color. success: Green. danger: Red. warning: Orange.

Type "neutral" | "primary" | "success" | "danger" | "warning"
Default "neutral"
Required No
size
size

Size variant. All sizes share the same height system as buttons. xs: Extra small. sm: Small. md: Default. lg: Large.

Type "xs" | "sm" | "md" | "lg"
Default "md"
Required No
type
type

HTML input type.

Type "text" | "search" | "number" | "email" | "password" | "tel" | "url"
Default "text"
Required No
passThrough
passThrough

Custom styling and props for each slot of the input.

Type { root?: { style?: SystemStyleObject; props?: Record<string, unknown> }; input?: { style?: SystemStyleObject; props?: Record<string, unknown> }; prefix?: { style?: SystemStyleObject; props?: Record<string, unknown> }; suffix?: { style?: SystemStyleObject; props?: Record<string, unknown> } }
Default undefined
Required No
...rest
...rest

Standard HTML input attributes passed to the inner input element.

Type HTMLAttributes<HTMLInputElement>
Default -
Required No