Skip to content

Search Input

InputMIT
View in Storybook

Search-styled input with icon, clear button, and keyboard handling.

bun add @otfdashkit/ui

Preview

Search Input
Loading Storybook preview…

Code

import React, { useState } from 'react'
import { SearchInput } from '@otfdashkit/ui'

function SearchDemo() {
  const [val, setVal] = useState('')
  return (
    <div className="flex flex-col gap-4 max-w-sm">
      <SearchInput placeholder="Search…" shortcut="⌘K" value={val} onChange={setVal} onClear={() => setVal('')} />
      <SearchInput placeholder="Filter results" value={val} onChange={setVal} />
    </div>
  )
}

export function Example() {
  return (
    <SearchDemo />
  )
}

Free with the SDK. This component ships in @otfdashkit/ui under the MIT license.

Props

Props declared in the SearchInput source. Inherited HTML attributes are not listed.

PropTypeDefaultDescription
onChange(value: string) => void
onClear() => void
shortcutstring