Data input

Choice Card

A radio button, checkbox or switch drawn as a card, with a title, a description and an optional icon, image or color swatch.

Class nameTypeDescription
choice-cardplf:choice-cardComponentA label drawn as a card around a radio button, checkbox or switch
choice-card-titleplf:choice-card-titlePartThe choice's name
choice-card-descriptionplf:choice-card-descriptionPartText after the title
choice-card-iconplf:choice-card-iconPartAn SVG icon above the choice; an icon class there doesn't need it
choice-card-imageplf:choice-card-imagePartAn image above the choice
choice-card-swatchplf:choice-card-swatchPartA color above the choice, or a palette with one span per color

Default

The card is the control’s <label>, so its parts are <span> elements: a label cannot hold a <div> or <p>.

Plan
Add-ons

Switch

A switch, for a setting that takes effect at once, sits at the end of the title’s row.

Notifications
Theme

Image

The title names the choice, so an image that only illustrates it takes alt=""; written alt text joins the choice’s name.

Workspace cover
Accent color
Chart colors

Disabled

Say why a choice is unavailable in its card; the disabled state alone does not explain it.

Region

Invalid

Your application adds and removes aria-invalid on each control and the message; start the message with “Error:” so the state does not rely on color alone.

Billing period

Error: choose a billing period.

React

ChoiceCard from @pelatform/react renders the card’s label around a Radio, Checkbox or Switch without children, and each part is a component of its own; an icon is an Icon in the card.

Part Element
ChoiceCardTitle A span with choice-card-title
ChoiceCardDescription A span with choice-card-description
ChoiceCardImage An img with choice-card-image
ChoiceCardSwatch A span with choice-card-swatch, colored by its style or by one span per color

Other props are the element’s own, className and ref included.

CSS variables

Override on a root or on a single card.

Variable Default
--plf-choice-card-padding --plf-space-4, 1rem (16px)
--plf-choice-card-radius --plf-radius-lg, 0.5rem (8px), as on inputs
--plf-choice-card-bg Transparent, the surface beneath
--plf-choice-card-border --plf-color-border-subtle
--plf-choice-card-hover-bg --plf-color-surface-hover
--plf-choice-card-selected-bg --plf-color-primary-subtle
--plf-choice-card-selected-border --plf-color-primary
--plf-choice-card-icon-size 1.5rem (24px)
--plf-choice-card-swatch-height --plf-space-8, 2rem (32px)
--plf-choice-size, --plf-choice-accent The control’s size and color, as on Radio; a switch takes Switch’s

Built with Pelatform UIv0.1.0

Components

Getting started

Foundations

Components

Actions

Data display

Navigation

Feedback

Data input

Layout

Advanced

Integrations

Blocks

Application

Authentication

Icons