Skip to content

shadcn.io is an independent project built on shadcn/ui

Free

Search Button Input Group for Solid

A search field with a labeled Search button at the end, meant for a query that runs on submit.

UI library: Ark UI

A search input with a Search button at the end. The button shows a magnifying glass and the word Search. Nothing in the demo runs a query.

Use it when search should wait for a press, not for each keystroke. Suggestions as someone types belong in a Combobox. In Solid, Ark UI does not submit the search.

Preview

Preview width

Installation

MCP · Pro
Make your AI a shadcn expert
Your agent installs components, builds pages and restyles your app from one prompt, in Claude Code, Cursor or VS Code.
Part of Pro

Anatomy

Input Group anatomy: root, addon, input, text, button

Usage

<InputGroup class="w-full max-w-sm bg-background">
    <InputGroupInput aria-label="Search" placeholder="Search..." type="search" />
    <InputGroupAddon align="inline-end" class="pe-2">
      <InputGroupButton size="sm" variant="secondary">
        Search
        <SearchIcon aria-hidden="true" data-icon="inline-end" />
      </InputGroupButton>
    </InputGroupAddon>
  </InputGroup>

FAQ

How is the Search button built?

An InputGroupButton with size="sm" and variant="secondary", its text followed by a magnifying glass marked data-icon="inline-end".

Why does the addon have pe-2?

It adds a little padding after the button so it doesn't touch the group's rounded end.

How do I run the search?

Wrap the group in a form and give the button type="submit", so Enter in the input and a click on the button both submit. InputGroupButton defaults to type="button".

Why type=search on the input?

It tells the browser and assistive tech this is a search field, and mobile keyboards show a search key. The input also has aria-label="Search" because there's no visible label.

Can I show only the icon?

Yes: drop the text, use size="icon-xs" and give the button aria-label="Search".

Does it work right to left?

Yes. The addon is inline-end and the padding is pe-2, so both follow the text direction.

API Reference

Input Group

Sets aria-label="Search", placeholder="Search...", type="search", align="inline-end", size="sm" and variant="secondary". The rest is on the Input Group page.