Logo

Component Blueprint

X: 1280 · Y: 720 · Grid: 8px

Toggle

Two-state button primitive with pressed state, variants, sizing, icons, labels, and reactive forms support.

01 Hero Preview

Grid: 8px · Scale: 1:1

02 Usage

TS

import { FrToggleModule } from '@frame-ui-ng/components/toggle';

HTML

<button frToggle>
  <span frToggleLabel>Toggle</span>
</button>

03 Examples

Basic

Use a toggle for a single independent on/off action such as saving, starring, or muting.

Component Sheet

Grid: 8px · Scale: 1:1

Outline

Use the outline variant when the toggle sits beside other bordered controls.

Component Sheet

Grid: 8px · Scale: 1:1

With Text

Project a label when the icon alone would be too ambiguous for the action.

Component Sheet

Grid: 8px · Scale: 1:1

Size

Choose small, default, or large sizing to match dense toolbars or larger action rows.

Component Sheet

Grid: 8px · Scale: 1:1

Disabled

Disabled toggles preserve their current state while blocking pointer and form interaction.

Component Sheet

Grid: 8px · Scale: 1:1

Controlled

Bind pressed and pressedChange when parent state should own the selected value.

Component Sheet

Grid: 8px · Scale: 1:1

Current value: on

Reactive Forms

Because FrToggle implements ControlValueAccessor, it can bind directly to a boolean FormControl.

Component Sheet

Grid: 8px · Scale: 1:1

Reactive form value: enabled

RTL

Toggle spacing is logical, so icon and label rhythm follows the document direction.

Component Sheet

Grid: 8px · Scale: 1:1

04 Custom Styling

Override toggle tokens on an individual control or a toolbar wrapper to tune selected states, border treatment, sizing, and motion.

Component Sheet

Grid: 8px · Scale: 1:1

05 Token Inspector

Hover the toggle root, pressed state, outline variant, icon, or label to inspect the tokens that shape the control.

06 Design Tokens

Use these CSS custom properties to tune toggle sizing, surface states, focus ring, disabled state, icon sizing, and transition timing.

SCSS

--frame-toggle-height: 2.25rem;
--frame-toggle-padding-x: 0.75rem;
--frame-toggle-gap: 0.5rem;
--frame-toggle-radius: var(--frame-radius-md);
--frame-toggle-font-size: 0.875rem;
--frame-toggle-font-weight: 600;
--frame-toggle-bg: transparent;
--frame-toggle-color: var(--frame-foreground);
--frame-toggle-border: transparent;
--frame-toggle-hover-bg: var(--frame-muted);
--frame-toggle-hover-color: var(--frame-foreground);
--frame-toggle-pressed-bg: var(--frame-accent, var(--frame-muted));
--frame-toggle-pressed-color: var(--frame-accent-foreground, var(--frame-foreground));
--frame-toggle-pressed-shadow: inset 0 1px 2px rgb(0 0 0 / 0.08);
--frame-toggle-outline-bg: var(--frame-background);
--frame-toggle-outline-border: var(--frame-border);
--frame-toggle-outline-hover-bg: var(--frame-muted);
--frame-toggle-outline-pressed-bg: var(--frame-muted);
--frame-toggle-focus-shadow: 0 0 0 3px color-mix(in srgb, var(--frame-ring) 28%, transparent);
--frame-toggle-disabled-opacity: 0.5;
--frame-toggle-transition-duration: 160ms;
--frame-toggle-icon-size: 1rem;