Skip to main content
Mantı UI logoMantı UIv0.12.1
Studio

Toggle

Use defaultPressed for uncontrolled state or pressed with onPressedChange for controlled state.

import { Toggle } from '@manti-ui/react';

export default function ToggleBasic() {
  return (
    <Toggle variant="primary" defaultPressed={false}>
      Spicy
    </Toggle>
  );
}

Controlled state

on

API

PropTypeDefaultDescription
variantMantiVariant'primary'Active variant when the toggle is pressed.
pressedbooleanControlled pressed state.
defaultPressedbooleanInitial pressed state for uncontrolled usage.
onPressedChange(pressed: boolean) => voidCalled whenever the pressed state changes.
disabledbooleanDisable the control.
iconOnlybooleanRender as a square, icon-only toggle. Provide an aria-label.
childrenReactNode | ((pressed: boolean) => ReactNode)Content, or a render function receiving the current pressed state.

Styling

Anatomy

PartSelectorDescription
root[data-scope="toggle"][data-part="root"]The pressable button. Off reads as a quiet outline; on fills with the variant.

Tokens

TokenControls
--manti-toggle-sizesize

Last updated

Built end-to-end with Manti UI components and design tokens. Manti UI is a framework-agnostic design system on Zag.js.

GitHub