Skip to content

Switch Card

Get Ritla UI

A settings row turned on or off with a switch, with an icon at the start, a headline and supporting text. The whole row is clickable.

Ritla scan of this preview: 41 of 41 checks3 breakpointsScanned

Open in Figma

Preview

Mirrored is the same English content laid out right to left: it separates a mirroring bug from a translation one.

PreviewCode
EnglishMirroredArabic
LTR →

Installation

  1. Add the component

    npx ritla add switch-card

    Also works with shadcn: npx shadcn@latest add @ritla/switch-card

  2. Or copy by hand

    Installing by hand copies the component's source into your project. The source comes with a Ritla UI license, so the CLI is the short way to the same files.

Usage

switch-card.tsx
import { SwitchCard } from "@/components/ui/switch-card";<SwitchCard leading={BellIcon} defaultChecked description="Transfers, card payments and logins">  Push notifications</SwitchCard>

Examples

Switch at the start

leading="switch" puts the switch at the start of the row.

EnglishMirroredArabic
LTR →

API reference

SwitchCard

PropTypeDefaultDescription
childrenReactNodeNoneFigma's Headline: the setting's name.
overline / description / trailingTextReactNodeNoneFigma's Overline, Supporting text and Trailing text.
leadingIconComponent | ReactNode | "switch"NoneFigma's Leading type.
checked / defaultChecked / onCheckedChange…NoneAs on Switch.
disabledbooleanNoneState = Disabled.

Accessibility

Keyboard

Keys are written for left-to-right. In right-to-left the arrow keys swap: the one pointing toward the reading direction moves forward.

KeyAction
SpaceToggles the switch; Tab moves between rows.

ARIA

  • Each switch is role="switch", named by its row's headline and linked to the supporting text.

Arabic and RTL notes

Mirrors

  • The icon sits at the start (the right), the switch at the end (the left), as Figma recommends for settings lists.

Does not mirror

  • Non-directional icons don't mirror.
Numerals
Numbers in the texts follow numerals.
Arabic typography
The headline is body-16 Medium.

Checks it passes

The Ritla checks this component satisfies by construction. Used as documented, it does not bring these defects onto your page.

  • R050Arabic text falling back past the declared font family (measured, declared, or a webfont that failed to load)
  • R051letter-spacing applied to Arabic text (breaks the connected script)
  • R042Clipped text: content wider than its box with overflow hidden and no ellipsis
  • R043Fixed-pixel-width container whose Arabic text exceeds the space