Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/selectable-card-examples-multi-select.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@astryxdesign/cli': patch
---

[docs] The SelectableCard showcase and elevated examples are multi-select: each card is a checkbox that toggles on its own, so the examples no longer show a single-choice picker built from checkboxes. The showcase is an add-on picker.

@cixzhang
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const doc = {
name: 'SelectableCard — Elevated',
displayName: 'Selectable Card — Elevated',
description:
'Raised selectable cards with `elevation="low"`. The inset selection ring composes on top of the shadow, so a selected card keeps its elevation.',
'Raised selectable cards with `elevation="low"`, each toggling on its own. The inset selection ring composes on top of the shadow, so a selected card keeps its elevation.',
isReady: true,
aspectRatio: 2,
componentsUsed: ['SelectableCard', 'Layout', 'Text'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,35 @@ import {SelectableCard} from '@astryxdesign/core/SelectableCard';
import {Grid} from '@astryxdesign/core/Grid';
import {Text} from '@astryxdesign/core/Text';

const PLANS = [
{id: 'starter', name: 'Starter'},
{id: 'pro', name: 'Pro'},
const UPDATES = [
{id: 'email', name: 'Email updates'},
{id: 'digest', name: 'Weekly digest'},
];

export default function SelectableCardElevated() {
const [selected, setSelected] = useState('pro');
const [selected, setSelected] = useState(new Set(['digest']));

return (
<Grid columns={2} gap={3} width={420} maxWidth="100%">
{PLANS.map(plan => (
{UPDATES.map(update => (
<SelectableCard
key={plan.id}
label={plan.name}
isSelected={selected === plan.id}
onChange={() => setSelected(plan.id)}
key={update.id}
label={update.name}
isSelected={selected.has(update.id)}
onChange={isNow => {
setSelected(prev => {
const next = new Set(prev);
if (isNow) {
next.add(update.id);
} else {
next.delete(update.id);
}
return next;
});
}}
elevation="low">
<Text type="body" weight="bold">
{plan.name}
{update.name}
</Text>
<Text type="supporting" color="secondary">
The resting shadow stays put — the selection ring layers on top.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const doc = {
name: 'SelectableCard',
displayName: 'Selectable Card',
description:
'A plan picker with single-select radio behavior. Cards show an accent border when selected.',
'An add-on picker where several options can be on at once: each card is a checkbox that toggles on its own, and a selected card shows an accent ring.',
isReady: true,
isShowcase: true,
aspectRatio: 2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,56 @@ import {SelectableCard} from '@astryxdesign/core/SelectableCard';
import {Stack} from '@astryxdesign/core/Layout';
import {Text, Heading} from '@astryxdesign/core/Text';

const plans = [
{id: 'basic', name: 'Basic', price: '$9/mo', desc: 'For individuals'},
{id: 'pro', name: 'Pro', price: '$29/mo', desc: 'For small teams'},
const addOns = [
{
id: 'enterprise',
name: 'Enterprise',
price: '$99/mo',
desc: 'For organizations',
id: 'storage',
name: 'Extra storage',
price: '+$5/mo',
desc: '100 GB more space',
},
{
id: 'support',
name: 'Priority support',
price: '+$15/mo',
desc: 'Replies within an hour',
},
{
id: 'backups',
name: 'Daily backups',
price: '+$10/mo',
desc: 'Kept for 30 days',
},
];

export default function SelectableCardShowcase() {
const [selected, setSelected] = useState<string | null>('pro');
const [selected, setSelected] = useState(new Set(['backups']));

return (
<Stack direction="horizontal" gap={3}>
{plans.map(plan => (
{addOns.map(addOn => (
<SelectableCard
key={plan.id}
label={plan.name}
isSelected={selected === plan.id}
onChange={() => setSelected(plan.id)}
key={addOn.id}
label={addOn.name}
isSelected={selected.has(addOn.id)}
onChange={isNow => {
setSelected(prev => {
const next = new Set(prev);
if (isNow) {
next.add(addOn.id);
} else {
next.delete(addOn.id);
}
return next;
});
}}
width={180}>
<Stack direction="vertical" gap={1}>
<Heading level={4}>{plan.name}</Heading>
<Heading level={4}>{addOn.name}</Heading>
<Text type="large" weight="bold">
{plan.price}
{addOn.price}
</Text>
<Text type="supporting" color="secondary">
{plan.desc}
{addOn.desc}
</Text>
</Stack>
</SelectableCard>
Expand Down
Loading