Astryx

Astryx Selectable Card

Cards

About

A card that toggles between selected and unselected states with an accent border. For navigation use ClickableCard. Astryx by Meta. Source: https://astryx.atmeta.com/components/SelectableCard

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Astryx Selectable Card to your project and fits it to your theme.

Code

How Astryx Selectable Card is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

'use client';

/* Copyright (c) 2026 Meta Platforms, Inc. See MIT notice in astryx-selectable-card.tsx. */

import '@/components/ui/astryx-selectable-card-utils/astryx-preview.css';
import {useState} from 'react';
import {SelectableCard} from '@/components/ui/astryx-selectable-card';
import {Stack} from '@astryxdesign/core/Layout';
import {Text, Heading} from '@astryxdesign/core/Text';

const addOns = [
  {
    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',
  },
];

function OfficialSample() {
  const [selected, setSelected] = useState(new Set(['backups']));

  return (
    <div style={{display: 'grid', width: '100%', gridTemplateColumns: 'repeat(auto-fit, minmax(min(100%, 172px), 1fr))', gap: 12}}>
      {addOns.map(addOn => (
        <SelectableCard
          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="100%">
          <Stack direction="vertical" gap={1}>
            <Heading level={4}>{addOn.name}</Heading>
            <Text type="large" weight="bold">
              {addOn.price}
            </Text>
            <Text type="supporting" color="secondary">
              {addOn.desc}
            </Text>
          </Stack>
        </SelectableCard>
      ))}
    </div>
  );
}

export default function Demo() {
  return (
    <div className="astryx-demo" data-astryx-theme="neutral" data-theme="light">
      <div className="astryx-demo-content" data-centered style={{maxWidth: 580}}>
        <OfficialSample />
      </div>
    </div>
  );
}

Dependencies

More by Astryx

View all
  • Astryx Banner

    Astryx Banner

    61
  • Astryx Avatar

    Astryx Avatar

    34
  • Astryx Aspect Ratio

    Astryx Aspect Ratio

    32
  • Astryx Badge

    Astryx Badge

    30
  • Astryx Button Group

    Astryx Button Group

    29
  • Astryx Chat Composer Drawer

    Astryx Chat Composer Drawer

    27
  • Astryx Toggle Button

    Astryx Toggle Button

    17
  • Astryx Chat Tokenized Text

    Astryx Chat Tokenized Text

    10

More in Cards

View all
  • Course Design Cards

    Course Design Cards

    1.3K
  • Weather Card

    Weather Card

    69
  • Statistics Card 7

    Statistics Card 7

    340
  • Stats cards with links

    Stats cards with links

    102
  • Statistics Card 2

    Statistics Card 2

    316
  • Approval Card

    Approval Card

    37
  • Recipe Card

    Recipe Card

    53
  • The Item one

    The Item one

    4