4.2.0
Core

Switch

A boolean that applies the moment it is flipped.

Default

Two states, and each side of the flip needs the other beside it to read as a state rather than just a colour.

Usage

import { Switch } from '@oceanic-hub/brand-system'

If the change needs a Save button, use a Checkbox. A switch that does not take effect immediately is the settings-screen bug that survives every review.

Two states only. Unlike Checkbox next door, checked takes no 'indeterminate' value — a setting is either applied or it is not, and a half-applied setting has no rendering and no meaning (switch.contract.test-d.ts measures this rather than asserting it).

Putting the label and description first and the control last, so the reader has finished reading before the toggle is under their thumb, is Field's job — see its "Switch row" section for the composed shape; this page's own scope is the control alone.

There is no size prop. Track and thumb are one fixed size (36×20, a 16px thumb), on the pill radius this package keeps for its knobs and chips rather than one this component owns — so a caller resizing a switch class-by-class would be free-handing a size the doctrine has not measured or approved.

Invalid is a solid stuck border, and it is stated twice. aria-invalid on the control paints it — that is the attribute assistive technology already reads — and a Field marked data-invalid paints it too, so a surface that wires only one of the two still draws the line (@OCE-1877). Neither is the whole message: FieldError carries the sentence, in ink beside a stuck mark, because a border can say that something is wrong and never what. Field's page shows the line drawn on every control at once.

RTL is not supported — recorded in pairings.json under direction: nothing in this package has ever been laid out or measured right-to-left, and upstream ships an RTL example.

Disabled

A setting locked by policy rather than by the reader's own choice still shows its state — disabled never means hidden.

API Reference

See the Switch API page for every prop of every part, with types, defaults and the contract that pins them.

On this page