Skip to content

Search Bar

Get Ritla UI

Search in an app header: a 56px rounded bar with the menu button, the search input and up to two actions or an avatar.

Ritla scan of this preview: 41 of 41 checks3 breakpointsScanned

Open in Figma

Preview

Mirrored is the same English content laid out right to left: it separates a mirroring bug from a translation one.

PreviewCode
EnglishMirroredArabic
LTR →

Installation

  1. Add the component

    npx ritla add search-bar

    Also works with shadcn: npx shadcn@latest add @ritla/search-bar

  2. Or copy by hand

    Installing by hand copies the component's source into your project. The source comes with a Ritla UI license, so the CLI is the short way to the same files.

Usage

search-bar.tsx
import { SearchBar } from "@/components/ui/search-bar";<SearchBar  label="Search"  leading={<IconButton variant="ghost" size="md" shape="round" icon={ListIcon} label="Menu" />}  trailing={<IconButton variant="ghost" size="md" shape="round" icon={MicrophoneIcon} label="Search by voice" />}/>

Examples

Actions

One or two trailing actions (Show 2nd button). A back arrow at the start points the reading direction.

EnglishMirroredArabic
LTR →

API reference

SearchBar

Also takes <input> props.

PropTypeDefaultDescription
labelstringNoneThe input's screen reader name and placeholder. Write it in the page language.
leadingReactNodeNoneLeading Button: usually a round ghost IconButton for the menu.
trailingReactNodeNoneTrailing Button 1 and 2, or the avatar (Show avatar).

Accessibility

Keyboard

Keys are written for left-to-right. In right-to-left the arrow keys swap: the one pointing toward the reading direction moves forward.

KeyAction
TabThe menu button, then the input, which turns the bar's border dark blue with a soft halo, then the actions.

ARIA

  • The bar is role="search" and the input type="search" with a name (label).
  • Icon buttons need names (label on IconButton).

Arabic and RTL notes

Mirrors

  • The menu button sits at the start (the right), the actions at the end (the left).

Does not mirror

  • The menu, magnifier and microphone icons don't mirror.
Numerals
No numbers in the bar.
Arabic typography
label-16.
Mixed-direction text
The input takes dir="auto".

Checks it passes

The Ritla checks this component satisfies by construction. Used as documented, it does not bring these defects onto your page.

  • R023Text inputs rendered LTR where Arabic input is expected