Blackwork
Scroll to top

Widgets

Content-site chrome such as language, search, social links, and typography.

Widgets

Widgets are small Blackwork pieces for a content site. They are not shadcn primitives.

Put LanguageToggle and SocialLinks in LayoutHeader. ScrollToTop is already mounted on this docs site.

When to use

  • Locale switching in the header
  • A search field or command-palette entry
  • Brand marks for GitHub, X, RSS, and similar
  • Headings and body copy that match the type scale

Generic icons still come from lucide-react. See Icons. Brand marks stay inside SocialLink.

Language toggle

One option renders a button. An array renders a dropdown. Routing is your job: pass onClick on each option.

Language toggle

LanguageToggle

PropTypeDefaultDescription
optionsrequiredLanguageToggleOption | LanguageToggleOption[]One option renders a button. An array renders a dropdown.
defaultValuestringCurrent locale. Used to pick the trigger icon.
titlestringTooltip on the trigger.
ariaLabelstringAccessible name. Falls back to title.

Search input

A search-styled input with a leading icon. It does not run a query.

Search input

SearchInput

PropTypeDefaultDescription
placeholderstring"Search..."Native input placeholder.
inputRefRefObject<HTMLInputElement>Ref for the inner input.
inputClassNamestringClasses for the inner input.
searchIconClassNamestringClasses for the search icon.

Social links

SocialLink

PropTypeDefaultDescription
typerequired"github" | "x" | "twitter" | "instagram" | "zhihu" | "rss"Built-in brand mark. Other types render nothing.
linkrequiredstringDestination URL. Opens in a new tab.
labelstringTooltip. Defaults to the brand name.
ariaLabelstringAccessible name. Defaults to Visit {label} in a new tab.

Scroll to top

Fixed to the bottom-right of the viewport. Give the icon-only button a name.

Scroll to top

ScrollToTop

PropTypeDefaultDescription
titlestringTooltip on the button.
ariaLabelstringAccessible name for the icon-only button.
variantButton variant"ghost"Passed through to Button.

Typography

Heading maps level to h1h4. Paragraph is the matching body style.

Typography

Section title

Body copy for a content page.

Heading

PropTypeDefaultDescription
level1 | 2 | 3 | 41Renders h1 through h4 with the matching type scale.

Opens in a new tab with rel="nofollow noopener noreferrer".

External link

Building blocks for a command-palette dialog. useQuickSearchState toggles on ⌘K / Ctrl+K. The preview below uses local state so it does not steal this site's shortcut.

Quick search

Notes

  • SocialLink only knows github, x, twitter, instagram, zhihu, and rss.
  • ScrollToTop is position: fixed. Override className if you need it in a boxed preview.
  • SearchInput is presentation. Pair it with your own submit or filter logic.
  • This site's header search is a consumer of QuickSearchDialog, not a different component family.