search-field-controlled

PreviousNext
Docs
takiexample

Preview

Loading preview…
registry/new-york/examples/search-field-controlled.tsx
"use client"

import { useState } from "react"

import { SearchField } from "@/registry/new-york/ui/search-field"

export default function SearchFieldControlled() {
  const [value, setValue] = useState("")

  return (
    <div className="grid w-full max-w-md gap-4">
      <SearchField
        label="Search"
        description={
          value ? `Searching for: "${value}"` : "Enter a search term"
        }
        placeholder="Search..."
        value={value}
        onChange={setValue}
      />
    </div>
  )
}

Installation

npx shadcn@latest add @taki/search-field-controlled

Usage

import { SearchFieldControlled } from "@/components/search-field-controlled"
<SearchFieldControlled />