Search Input

Search field with clear control, icon placement, background fill, and hover border.

Also known as: search bar, SearchBar, search field, search box

Installation

Install with the CLI, or copy the component source into your project.

Add search-input (npm)

npx --yes -p @default-file/ui df-ui add search-input

Default

Search field with clear control.

Variants

Same field, search icon on the left or right.

Sizes

Small, medium, and large.

Hover border

Inherits the theme hover border. Override with hoverBorderColor, or set hoverBorder false.

Background

Override the field fill with background. Sets --df-input-bg and replaces the default and pill recipes.

Properties

Search field with clear control, sizes, icon placement, background fill, and Input hover border controls. Block padding stays equal; Input optical shift is disabled. SearchBar is an alias.

SearchInput

PropTypeDefaultNotes
variant"default" | "pill""default"Field shape.
size"sm" | "md" | "lg""md"T-shirt height and type size.
iconPosition"start" | "end""start"Side for the leading search icon.
leadingIconReactNode | false-Override or hide the default search icon.
trailingReactNode-Custom trailing slot beside clear when present.
clearablebooleantrueShow a clear control when the field has a value.
onClear() => void-Called when the clear control is activated.
backgroundstring-Field fill. Prefer tokens such as var(--muted). Forwards to Input, sets --df-input-bg, and overrides the default and pill recipes for resting and filled states.
hoverBorderboolean-Forwards to Input. Omit to inherit the theme. Set false to keep the resting border. Set true to force the hover border on.
hoverBorderColorstring-Forwards to Input. Hover border color when hover is active. Prefer tokens such as var(--foreground). Sets --df-input-hover-border.
inputClassNamestring-Classes on the inner input element.
classNamestring-Classes on the outer search shell.

Tokens

Theme defaults live on :root. Override these globally or on a local host.

TokenTypeDefaultNotes
--df-input-bgCSS colorvar(--background)Resolved field fill on the inner Input. Set by variant recipes or the background prop.
--df-search-input-bgCSS colorcolor-mix(in oklch, var(--muted) 50%, var(--background))Pill resting fill recipe. Mapped to --df-input-bg unless background is set.
--df-search-input-bg-filledCSS colorcolor-mix(in oklch, var(--muted) 70%, var(--background))Pill filled fill recipe. Mapped to --df-input-bg unless background is set.
--inputCSS colorvar(--df-neutral-100)Field border.
--borderCSS colorvar(--df-neutral-100)Fallback border.
--df-hover-borderCSS keywordonTheme field hover border. on paints the ink hover border; off keeps the resting border. Runtime gating uses data-df-hover-border on html. Set with df-ui init --hover-border. Default on.
--df-input-hover-borderCSS colorvar(--foreground)Hover border on the inner Input when the theme or instance enables hover. Defaults to the ink foreground. Override with hoverBorderColor.
--muted-foregroundCSS colorvar(--df-neutral-500)Icon and placeholder color.
--spacing-unitCSS length0.25remBase unit for padding and gap.
--df-corner-shapeCSS corner-shapevar(--df-corner-shape-round)Theme corner curve for all kit chrome. round = circular arcs; smooth = continuous squircle. Set with df-ui init --corner-shape, or override on :root. Default round.