Search Box Glass
shadcn-glass-ui/search-box-glassFreeComponent
Search input with glassmorphism styling and integrated submit button. * Provides a cohesive search experience with visual feedback and keyboard support. * * ## Features
Install it
npx shadcn@latest add https://raw.githubusercontent.com/artyhoo/shadcn-glass-ui-library/main/public/r/search-box-glass.jsonSource
1/**2 * SearchBoxGlass Component3 *4 * Search input with glassmorphism styling and integrated submit button.5 * Provides a cohesive search experience with visual feedback and keyboard support.6 *7 * ## Features8 * - Search input with glass theme styling9 * - Built-in search icon (magnifying glass) on left side10 * - Submit button with Search icon and optional text label11 * - Compact variant (icon-only button) for mobile layouts12 * - Focus glow effect for visual feedback13 * - Enter key submission for keyboard users14 * - Controlled or uncontrolled component modes15 * - Customizable input width via Tailwind classes16 * - Responsive design (adapts button label on small screens)17 * - Accessible with proper ARIA labels18 *19 * ## CSS Variables20 * Uses InputGlass CSS variables:21 * - `--search-bg` - Input background color22 * - `--search-border` - Input border color23 * - `--search-btn-bg` - Submit button background24 * - `--search-btn-text` - Submit button text color25 * - `--text-primary` - Input text color26 * - `--focus-glow` - Focus ring glow effect27 *28 * @example Basic search box29 * ```tsx30 * import { SearchBoxGlass } from 'shadcn-glass-ui'31 *32 * function SearchBar() {33 * const handleSearch = (query: string) => {34 * console.log('Searching for:', query)35 * }36 *37 * return (38 * <SearchBoxGlass39 * onSubmit={handleSearch}40 * placeholder="Search repositories..."41 * />42 * )43 * }44 * ```45 *46 * @example Controlled search box47 * ```tsx48 * function ControlledSearch() {49 * const [query, setQuery] = useState('')50 *51 * return (52 * <SearchBoxGlass53 * value={query}54 * onChange={setQuery}55 * onSubmit={(q) => console.log('Submitted:', q)}56 * />57 * )58 * }59 * ```60 *61 * @example Compact variant for mobile62 * ```tsx63 * <SearchBoxGlass64 * variant="compact"65 * placeholder="Search..."66 * onSubmit={handleSearch}67 * />68 * ```69 *70 * @example Custom width71 * ```tsx72 * <SearchBoxGlass73 * inputWidth="w-64 md:w-96"74 * placeholder="Search users..."75 * onSubmit={handleSearch}76 * />77 * ```78 *79 * @accessibility80 * - Input has aria-label matching placeholder text81 * - Submit button has aria-label "Search"82 * - Keyboard accessible (Tab to navigate, Enter to submit)83 * - Focus ring visible via --focus-glow CSS variable84 * - Search icon provides visual affordance85 *86 * @since v1.0.087 */8889import { forwardRef, useState, type InputHTMLAttributes, type CSSProperties } from 'react';90import { Search } from 'lucide-react';91// … truncated
More from shadcn-glass-ui
All 76 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Alert Glassalert-glass | shadcn-glass-ui | Components | Free | no deps | |
| Animated Background Glassanimated-background-glass | shadcn-glass-ui | Components | Free | no deps | |
| Avatar Glassavatar-glass | shadcn-glass-ui | Components | Free | no deps | |
| Badge Glassbadge-glass | shadcn-glass-ui | Components | Free | no deps | |
| Base Progress Glassbase-progress-glass | shadcn-glass-ui | Components | Free | no deps | |
| Button Glassbutton-glass | shadcn-glass-ui | Components | Free | no deps | |
| Card Glasscard-glass | shadcn-glass-ui | Components | Free | no deps | |
| Checkbox Glasscheckbox-glass | shadcn-glass-ui | Components | Free | no deps |
