// Generated by scripts/generate-showcase.mjs. Do not edit directly. page SearchBoxDetail { layout = "showcase" state playground_size = ctx.url.searchParams.get("pg_size") ?? "default" state playground_color = ctx.url.searchParams.get("pg_color") ?? "primary" state playground_label = ctx.url.searchParams.get("pg_label") ?? "Search Box" state playground_name = ctx.url.searchParams.get("pg_name") ?? "" state playground_value = ctx.url.searchParams.get("pg_value") ?? "sample-1" state playground_placeholder = ctx.url.searchParams.get("pg_placeholder") ?? "Enter a sample value" state playground_type = ctx.url.searchParams.get("pg_type") ?? "search" state playground_min = ctx.url.searchParams.get("pg_min") ?? "" state playground_max = ctx.url.searchParams.get("pg_max") ?? "" state playground_step = ctx.url.searchParams.get("pg_step") ?? "" state playground_disabled = (ctx.url.searchParams.get("pg_disabled") ?? "false") === "true" state playground_required = (ctx.url.searchParams.get("pg_required") ?? "false") === "true" state playground_class = ctx.url.searchParams.get("pg_class") ?? "showcase-instance showcase-instance--1" seo { title = "Search Box" description = "Provide an accessible responsive search field with labels, validation states, sizes, and input or change events." } view {
Forms component

Search Box

Provide an accessible responsive search field with labels, validation states, sizes, and input or change events.

13 props0 slots2 outputsTheme readyResponsive
Interactive playground

Configure Search Box

Change any prop and inspect the server-rendered component immediately.

Live preview
Component code
<SearchBox
  value="sample-1"
  placeholder="Enter a sample value"
/>
Event outputInteract with the preview to inspect the typed payload.
Component props13 controls
Live examples

Designed for real product surfaces

Compare configurations and resize the browser to check responsive behavior.

Recommended

Site search

Give visitors a clear way to search pages, services, or resources.

01
Live preview
Component usage.wrn
<SearchBox
  label="Search documentation"
  name="site-search"
  value="sample-1"
  placeholder="Search components and guides"
/>
Compact

Compact directory search

Use a compact field above tables, lists, and directories.

02
Live preview
Component usage.wrn
<SearchBox
  size="sm"
  label="Search stations"
  name="station-search"
  value="sample-2"
  placeholder="Name, district, or jurisdiction"
/>
Advanced

Required service lookup

Use validation and required semantics in focused lookup flows.

03
Live preview
Component usage.wrn
<SearchBox
  size="lg"
  color="info"
  label="Complaint reference"
  name="complaint-reference"
  value="sample-3"
  placeholder="Enter reference number"
  required="true"
/>
Component outputs

Receive every typed component output

Use declarative output handlers in .wrn files or register a direct output handler from JavaScript. The canonical API exposes payload and does not require event.detail.

@searchFires when the current search query changes.
@clearFires after the current value or selection is cleared.
Declarative handlers.wrn
<SearchBox
  @search='console.log(payload)'
  @clear='console.log(payload)'
/>
Direct output handlers.js
import { registerOutputHandler } from "@wrnexus/csr/outputs"

const component = document.querySelector("[data-ui-component=\"SearchBox\"], [data-component=\"SearchBox\"]")

if (component) registerOutputHandler(component, "search", (payload) => {
  console.log("search", payload)
})

if (component) registerOutputHandler(component, "clear", (payload) => {
  console.log("clear", payload)
})
Component API

Props and configuration

All content and behavior shown above is supplied through these props and slots.

PropTypeDefaultRequired
sizestring"default"No
colorstring"primary"No
labelstring"Search Box"No
namestring""No
valuestring""No
placeholderstring""No
typestring"search"No
minstring""No
maxstring""No
stepstring""No
disabledbooleanfalseNo
requiredbooleanfalseNo
classstring""No
} }