Skip to main content
Mantı UI logoMantı UIv0.13.0
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.
pressedboolean—Controlled pressed state.
defaultPressedboolean—Initial pressed state for uncontrolled usage.
onPressedChange(pressed: boolean) => void—Called whenever the pressed state changes.
disabledboolean—Disable the control.
iconOnlyboolean—Render 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