Skip to Content
DocumentationCardsCard Topic

CardTopic

An accordion-style row card for displaying a topic (subject/chapter) within a course. Supports default state with optional progress tracking and a blocked state for locked content with an availability date. Uses the Collapsible component internally with accordion animation.

Examples

In progress

The default state with a partially completed progress bar.

Lesson list goes here

Completed

Pass progress={100} to show the “Concluído” label with a full green bar.

No progress indicator

Omit CardTopicProgress when progress tracking is not applicable.

Blocked

Set variant="blocked" with a required availableDate. The progress area automatically shows a lock badge with the date. The number badge and title are visually muted. The trigger is non-interactive — no click, no chevron animation.

API Reference

Sub-components

Sub-componentDescriptionUsage notes
CardTopicRoot collapsible container. Provides variant context to all sub-components and applies the accordion animationAlways the outermost wrapper. Accepts all Collapsible props (open, defaultOpen, onOpenChange)
CardTopicTriggerFull-width clickable row that toggles the collapsible. Uses a flex row (the first child flexes to fill the available space) to position content. Disabled and non-interactive when variant="blocked"Place two CardTopicColumn children: first for number + title, second for progress + count
CardTopicColumnFlex row container for grouping sub-components side by side. The first child flexes to fill the available space while the rest stay at their natural sizeUse the first for CardTopicNumber + CardTopicTitle, the second for CardTopicProgress + CardTopicCount
CardTopicNumberCircular numbered badge. Muted background and text when variant="blocked"Pass the sequential number as children, e.g. 1
CardTopicTitleTopic name. flex-1 so it fills the left column. Muted text when variant="blocked"Pass the topic name as children
CardTopicProgressDisplays progress status. In-progress shows percentage + bar; completed shows “Concluído” + green bar; blocked shows lock icon + date. Renders nothing if progress is omitted and variant is not blockedPass progress (0–100) for default variant. Omit or leave empty for blocked variant — date is injected from context
CardTopicCountItem count label with the animated chevron icon rendered internally. Chevron rotation is suppressed when variant="blocked"Pass the count string as children, e.g. 10 items
CardTopicContentCollapsible content area. Animated with accordion (slide up/down). Applies px-4 pb-4 padding by defaultPlace lesson cards, lists, or any content here. Omit entirely for blocked topics

CardTopic

PropTypeDefaultDescription
variant"default" | "blocked""default"Controls the visual state of the entire card and all variant-aware sub-components.
availableDatestring-Required when variant="blocked". Displayed in the lock badge inside CardTopicProgress (e.g. "05/03").
defaultOpenbooleanfalseInitial open state (uncontrolled mode).
openboolean-Controlled open state. Pair with onOpenChange.
onOpenChange(open: boolean) => void-Called when the open state changes.
…propsCollapsibleProps-All Radix Collapsible root props are forwarded.

CardTopicProgress

PropTypeDefaultDescription
progressnumber-Progress value 0–100. Clamped automatically. When omitted and variant is "default", the component renders nothing. When variant is "blocked", this prop is ignored.
Last updated on