Command Palette

Search for a command to run...

54
Blog
PreviousNext

Liquid Glass Searchbox

An iOS 26-inspired liquid glass searchbox with focus animations and SVG refraction effects.

Browser Compatibility

MDN Source
Chrome...
Full
Edge...
Full
Safari...
Full
Firefox...
Partial
Opera...
Full

Compatibility Note for Liquid Glass Refraction:

Firefox supports backdrop-filter but currently lacks support for referring to SVG filters via url(#filterId). This results in the surface appearing as a simple semi-transparent blur without the refractive liquid effect.

Loading...
"use client";
 
import { useState } from "react";
 
import { LiquidGlassSearchbox } from "@/components/jyotirmoydas/liquid-glass-searchbox";
 
export function LiquidGlassSearchboxDemo() {
  const [query, setQuery] = useState("");
 
  return (
    <LiquidGlassSearchbox
      value={query}
      onChange={setQuery}
      onClear={() => setQuery("")}
      placeholder="Search..."
    />
  );
}

Installation

bunx --bun shadcn@latest add @jyotirmoydas/liquid-glass-searchbox

Usage

import { LiquidGlassSearchbox } from "@/components/jyotirmoydas/liquid-glass-searchbox";
const [query, setQuery] = useState("");
 
<LiquidGlassSearchbox
  value={query}
  onChange={setQuery}
  onClear={() => setQuery("")}
  placeholder="Search..."
/>;

API Reference

Input Control

PropTypeDefaultDescription
valuestringControlled value of the searchbox.
onChange(value: string) => voidCallback when the input value changes.
onClear() => voidCallback when the clear button is clicked.
showClearButtonbooleantrueWhether to show the clear button when there's text.
placeholderstring"Search"Placeholder text for the input.
disabledbooleanfalseWhether the searchbox is disabled.

Appearance

PropTypeDefaultDescription
classNamestringAdditional CSS classes.
widthnumber420Width of the searchbox in pixels.
heightnumber56Height of the searchbox in pixels.
idleOpacitynumber0.05Background opacity when idle.
focusOpacitynumber0.2Background opacity when focused.

Optical Parameters

Fine-tune the liquid glass refraction effect.

PropTypeDefaultDescription
blurnumber1Blur level for the glass refraction effect.
specularOpacitynumber0.2Opacity of the specular highlight.
specularSaturationnumber4Saturation multiplier for the specular highlight.
refractionLevelnumber0.7Base refraction level (magnification intensity).

Examples

Default

Basic searchbox with default settings.

Loading...
"use client";
 
import { useState } from "react";
 
import { LiquidGlassSearchbox } from "@/components/jyotirmoydas/liquid-glass-searchbox";
 
export function LiquidGlassSearchboxDemo() {
  const [query, setQuery] = useState("");
 
  return (
    <LiquidGlassSearchbox
      value={query}
      onChange={setQuery}
      onClear={() => setQuery("")}
      placeholder="Search..."
    />
  );
}

Custom Dimensions & Optical Parameters

Smaller searchbox with custom optical settings.

Loading...
"use client";
 
import { useState } from "react";
 
import { LiquidGlassSearchbox } from "@/components/jyotirmoydas/liquid-glass-searchbox";
 
export function LiquidGlassSearchboxCustomDemo() {
  const [query, setQuery] = useState("");
 
  return (
    <LiquidGlassSearchbox
      value={query}
      onChange={setQuery}
      onClear={() => setQuery("")}
      placeholder="Find components..."
      width={350}
      height={48}
      blur={0.5}
      specularOpacity={0.3}
      refractionLevel={0.9}
    />
  );
}