PrimeBrickPrimeBrick
  • Docs
  • Contact
  • MIT License
  • Documentation
  • MCP Server
  • API Catalog
  • Services
  • Libraries
PrimeBrickPrimeBrick

© 2026 PrimeBrick. MIT License. v3.11.2

github
Backend
Frontend
    Developer Guide
      OverviewGetting startedUI stackApp shell & sidebarAuthentication & sessionsSystem settingsUI componentsUI patternsIcon ConventionsInput AnatomyField Hints & TooltipsButton Style StandardsEntity metadatai18n — Translations on the FrontendThe AI Tool Loop (caller-driven)Error HandlingComposables (use* hooks)
      Components
        Entity list tableComboSelectDynamicIconColorSelectorColorPickerAvatarPreviewEventCardCommandPaletteAppShellAppSidebarAppTopbarAppPageLayoutAppPageScaffoldAppPageBreadcrumbAppServerBannerBrowserClientInfoLangSelectThemeToggleSidebarAppLauncherSidebarHealthBadgeSidebarOrgSwitcherSidebarProfileMenuSidebarVersionBadgeButtonButton (async)FormPageLayoutFormLabelWithPriorityHelpPasswordChecklistChoiceboxDateWheelPickerEventToastLoadingBarMetadataLoadingJsonTableViewerNumberTickerStatCardToolbarDialogBorderedEntity Confirm DialogsSheet panelRFCErrorDialogLoginFormPasskeyButtonPasskeyEnrollmentAuthMethodsPromptDialogSessionExpiredDialogInputSliderSliderFieldSwitchFieldSelectableFieldsetBadgeValuesEditorTooltipFormPrimeFieldSmartRegexInput
      API Reference
Microservices
powered by Zudoku
Components

SwitchField

src/lib/components/ui/switch-field/switch-field.svelte

Purpose

SwitchField is the only standard for a labelled boolean switch in a form. The canonical order is switch FIRST, label immediately after:

Code
[Switch] Label [?]

Field help goes in the label tooltip (tooltip props) — the optional description sublabel is deprecated (hint standard: no inline hint lines).

Never use the label-left / switch-right (justify-between) layout, and never hand-roll Switch + <span> markup in a form — that is what SwitchField enforces.

The bare Switch component is reserved for composite widgets that own their labelling (ConfigValueInput, toolbar toggles like the AND/OR connector, thumbIcons toggles).

Usage

Code
<SwitchField id="enable-thinking" bind:checked={enable_thinking} label={$t('fields.enable_thinking')} tooltip={$t('fields.enable_thinking_help')} tooltipPriority="INFORMATION" data-testid="cerebellum-thinking" />

For external stores that cannot use bind: (superForm, builders), use checked + onCheckedChange:

Code
<SwitchField checked={$form.reserved} onCheckedChange={(c) => ($form.reserved = c)} label={$t('...reserved')} tooltip={$t('...reservedHelp')} tooltipPriority="INFORMATION" />

Props

PropTypePurpose
checkedboolean (bindable)switch state
onCheckedChange(checked: boolean) => voidalternative to bind: for external stores
labelstringlabel rendered right after the switch
descriptionstringdeprecated — muted sublabel under the row; use tooltip instead
tooltipstringoptional help text; renders a ? FormLabelWithPriorityHelp inside the label
tooltipTitlestringoptional tooltip heading
tooltipPriorityTooltipPriorityoptional priority-styled tooltip content
tooltipLabelKeystringoptional muted italic i18n key next to the ? icon
disabledbooleandisables the switch (label gets peer-disabled styling)
size'default' | 'sm'label density — default: text-sm font-medium (form pages); sm: text-xs font-medium text-muted-foreground (dense sheets). Layout only, never affects colors/gradients
idstringforwarded to the switch so the external <label for> works
data-testidstringon the wrapper; the inner switch gets <testid>-switch

Canonical uses: AiCerebellumPanel (all boolean fields), configurations/create (Reserved), ValidationRulesSection (required/unsigned), regex-flags-panel.

Last modified on October 28, 2026
SliderFieldSelectableFieldset
On this page
  • Purpose
  • Usage
  • Props