Skip to main content
NetScriptdocs Search docs ⌘K v0.0.9
Browse documentation

Search

Compact nav search affordance — a button styled as an input with a ⌘K hint that opens the command palette.

All components · Theme builder · Implementation source

Live preview

Open live search preview

Install

Shell
netscript ui:add search

Usage and examples

The preview runs this JSX with the installed components. Import any composed primitives from your UI directory.

TypeScript
import { useState } from 'preact/hooks';
import { Search } from '@app/components/ui/search.tsx';

export function Example() {
  const [value, setValue] = useState('standard');
  const [open, setOpen] = useState(false);
  const [notice, report] = useState('');
  return (<><div><Search aria-label="Search orders" placeholder="Search orders…" onOpen={()=>report("Search opened")} /></div><p role="status">{notice}</p></>);
}

Props

Generated from native deno doc --json --private over the shipped implementation. Compound component props retain their owning interface; native attributes pass through where declared.

OwnerPropTypeOptionalDescription
SearchPropsplaceholderstringYesPlaceholder/label copy shown inside the field.
SearchPropsshortcutstringYesKeyboard hint glyphs, e.g. `⌘K`. Hidden when empty.
SearchPropsonOpen() => voidYesInvoked when the field is activated (opens the palette).
SearchPropsclassstringYes
TypeScript
SearchProps extends Omit<JSX.HTMLAttributes<HTMLButtonElement>, "class" | "onClick">

Keyboard

KeyAction
EnterActivate
SpaceActivate button; links use native Enter

Tokens

Semantic contract roles: border/default, border/hover, radius/input, surface/card, text/fg, text/muted.

CSS custom properties referenced directly: --ns-border, --ns-border-control, --ns-border-hover, --ns-card, --ns-control-height, --ns-ease-fast, --ns-focus-ring-offset, --ns-focus-ring-width, --ns-font-mono, --ns-font-sans, --ns-input-border, --ns-leading-snug, --ns-muted, --ns-muted-fg, --ns-radius-badge, --ns-radius-input, --ns-radius-md, --ns-radius-sm, --ns-ring, --ns-space-0-5, --ns-space-1-5, --ns-space-2, --ns-space-3, --ns-surface, --ns-text-2xs, --ns-text-base, --ns-text-body, --ns-text-caption, --ns-text-sm.

Contract and compatibility

Accessibility pattern: WAI-ARIA guidance

  • Native DOM attributes pass through where the implementation accepts them.

Design contract values marked planned are not implementation props. The props above describe what ships today.

Search all documentation

Type a term to search the documentation.