---
name: react-magma
description: Use when writing or editing React UI in a project that depends on react-magma-dom (Cengage's accessible component library) — finding the right component, its props, theming, inverse surfaces, icons and accessibility.
---

# React Magma (react-magma-dom 7.1.0)

Accessible React component library. This guide is generated for react-magma-dom 7.1.0, which requires React ^18.3.1.

## How to use this guide

1. Find the matching component in the Catalog before creating UI. Use it whenever its API supports the requested behavior.
2. Read the installed declarations and JSDoc: required/optional props, defaults, accepted values and enums. Inspect implementation when unclear; never guess or force unsupported props with casts or `any`.
3. Before layout or styling work, read [styling-guide.md](styling-guide.md). Read [setup-guide.md](setup-guide.md) for app setup and theme APIs.
4. Preserve requested behavior; do not invent required fields, validation or defaults.
5. Review your diff against the rules below, then run the project's configured type-check. A bundler build may not check TypeScript; report when no type-check is available.

## Required design-system rules

- Use `Heading` with a semantic `level` instead of raw `h1`–`h6`, and `Paragraph` instead of raw `p` for standalone content; preserve built-in component typography. Use Magma typography variants for other styled text.
- Use Magma layout and widgets: `Container`, `Flex`, `Grid`, `Spacer`, `Card`, `Table`, `Tabs`, `Pagination`, `EmptyState`, etc. Keep native semantic landmarks; custom replacements require an API gap or an explicit user/project exception. Explain any exception.
- Read the active `ThemeContext` for spacing, colors, fonts, text sizes, radii, icons and breakpoints. Do not introduce literal design values, external fonts or cosmetic overrides of Magma states.
- Map intended spacing to the nearest active `spaceScale` value; ties use the smaller value. With default tokens, 5px becomes `spacing02` (4px), not a new 5px rule. Do not bypass tokens with arithmetic. Preserve explicit requirements and accessibility constraints; see [styling-guide.md](styling-guide.md) for structural CSS exceptions.

## Library conventions

- Omit optional props when the desired value is already the component default. Verify defaults in the installed version's declarations, JSDoc or implementation before omitting them. Set props explicitly when overriding a default; keep required props and explicit values needed to override inherited context.
- Import from the package root: `import { Button, ButtonColor } from 'react-magma-dom'`.
- Variants are exported enums (`ButtonColor.secondary`, `ModalSize.large`).
- Dark backgrounds: `isInverse` prop, or `<InverseContext.Provider value={{ isInverse: true }}>` for a region.
- Accessibility is built in: form fields take `labelText`, icon-only buttons require `aria-label`, `Heading` takes a semantic `level`.
- `Hyperlink` takes `to`, not `href`.
- When an icon is needed, look for it in `react-magma-icons` first and verify its exported name and props in the installed package. Import from `react-magma-icons`; don't draw a replacement or use another icon library unless the project specifically requires it.
- Charts and file upload ship as separate packages, listed under Add-on packages with their package name. If the package is not installed, propose installing it and ask first. Read its declarations under `node_modules/<package>/dist`. Charts also need `import '@react-magma/charts/dist/charts.css'` once.

Theme, i18n, and other package-level APIs: [setup-guide.md](setup-guide.md).

## Catalog

Format: **Folder** — purpose (search words). Not for: need → better component. Also: related exports. Exports not listed are internal helpers.

### Actions
- **Button** — Performs an action or submits a form (button, cta, submit, primary action). Not for: navigation → Hyperlink; icon only → IconButton; on/off setting → Toggle. Also: ButtonColor, ButtonShape, ButtonSize, ButtonTextTransform, ButtonType, ButtonVariant
- **IconButton** — Button with an icon, with or without text (icon button, close button, toolbar button). Also: ButtonIconPosition
- **AIButton** — Animated gradient button for AI features (ai action, generate, assistant button). Also: AIButtonShape, AIButtonSize, AIButtonTextTransform, AIButtonType, AIButtonVariant
- **ButtonGroup** — Lays out and aligns related buttons (button bar, actions row, button set). Also: ButtonGroupAlignment, ButtonGroupOrientation
- **ToggleButton** — Button with a pressed/selected state (pressed button, bold/italic toggle, selectable button). Also: ToggleButtonRole
- **ToggleButtonGroup** — Group of ToggleButtons with single or multiple selection (segmented control, view switcher, button toggle group). Also: ToggleButtonGroupRole
- **Dropdown** — Menu of actions or links opened from a button (menu, actions menu, kebab menu, overflow menu, split button). Not for: choosing a form value → Select. Also: DropdownAlignment, DropdownButton, DropdownContent, DropdownDivider, DropdownDropDirection, DropdownExpandableMenuButton, DropdownExpandableMenuGroup, DropdownExpandableMenuItem, DropdownExpandableMenuListItem, DropdownExpandableMenuPanel, DropdownHeader, DropdownMenuGroup, DropdownMenuItem, DropdownMenuNavItem, DropdownSplitButton

### Forms
- **Form** — Form container with header, description and actions (form, form layout)
- **Input** — Text field with label, helper and error message (text field, textbox, email field, number field, form field). Also: InputMessage
- **PasswordInput** — Password field with show/hide toggle (password, show password)
- **Search** — Search field with `onSearch`, clear and loading states (search box, search bar, filter field)
- **Textarea** — Multi-line text field (textarea, comment box, multiline input)
- **CharacterCounter** — Remaining-characters counter; prefer `maxCount` on Input/Textarea (character limit, char count)
- **Select** — Choose one or many (`isMulti`) values from a list (dropdown list, picker, single select, multi select). Not for: typing to filter or create → Combobox; browser-native list → NativeSelect; action menu → Dropdown
- **Combobox** — Select with typing, filtering and creating items (autocomplete, typeahead, searchable select, creatable select)
- **NativeSelect** — Magma-styled browser <select> (native select, html select)
- **Checkbox** — Checkbox for one boolean or one of many options (checkbox, check box, agree). Also: CheckboxTextPosition
- **IndeterminateCheckbox** — Tri-state checkbox (checked, unchecked, indeterminate) (select all, partial selection, tri-state). Also: IndeterminateCheckboxStatus
- **Radio** — Single radio option; use inside RadioGroup (radio, radio button, option). Also: RadioTextPosition
- **RadioGroup** — Labelled group of mutually exclusive Radios (radio group, choose one)
- **Toggle** — On/off switch for a setting (switch, toggle switch, enable setting). Also: ToggleTextPosition
- **DatePicker** — Date field with calendar popup (date, calendar, date input)
- **TimePicker** — Time field with keyboard entry (time, time input, clock)
- **DateTimePicker** — Combined date and time field (datetime, date and time, schedule)
- **FormGroup** — Labelled group of Checkboxes or Toggles with shared error (checkbox group, checkbox list, options group)
- **Fieldset** — Semantic <fieldset> with legend for related controls (fieldset, legend, group of fields)
- **Label** — Standalone field label; fields already render `labelText` (label). Also: LabelPosition
- **FormFieldContainer** — Label, helper and error wiring for a custom field (custom field, field wrapper)
- **InputBase** — Low-level unlabelled input; prefer Input (bare input). Also: InputIconPosition, InputSize, InputType

### Overlays
- **Modal** — Dialog that blocks the page and traps focus (dialog, popup, lightbox, confirm window, overlay). Not for: side panel → Drawer; small anchored content → Popover. Also: ModalSize
- **Drawer** — Panel sliding in from a screen edge (side panel, off-canvas, slide-out, sheet, sidebar). Also: DrawerPosition
- **Popover** — Interactive content anchored to a trigger (popover, flyout, callout, info bubble). Not for: hover text only → Tooltip. Also: PopoverAlignment, PopoverContent, PopoverFooter, PopoverHeader, PopoverPosition, PopoverTrigger
- **Tooltip** — Short text on hover or focus (tooltip, hint, hover text). Also: TooltipArrow, TooltipPosition

### Feedback
- **AlertBase** — Low-level alert primitive used by Alert and Toast (alert primitive, toast primitive). Not for: standard inline alert → Alert. Also: AlertVariant
- **Alert** — Inline message with optional dismiss (alert, message, warning, error message, info box). Not for: page-wide notice → Banner; temporary notice → Toast
- **Banner** — Full-width system or app-level message (banner, announcement bar, site notice)
- **Toast** — Temporary notification; render inside ToastsContainer (toast, snackbar, notification, flash message). Also: ToastsContainer
- **EmptyState** — No-content message with icon and actions (empty state, no results, nothing here, zero state)
- **LoadingIndicator** — Page or section loading with progressive messages (loading screen, loader, please wait). Also: LoadingIndicatorType
- **Spinner** — Small inline loading spinner (spinner, busy indicator)
- **ProgressBar** — Linear progress of a task (progress bar, percent complete, upload progress). Also: ProgressBarColor
- **ProgressRing** — Circular progress indicator (progress circle, radial progress)
- **Skeleton** — Placeholder shapes while content loads (skeleton, shimmer, placeholder, ghost loading). Also: SkeletonAnimation, SkeletonVariant

### Navigation
- **Hyperlink** — Link (prop `to`), can look like a button (link, anchor, href, link button). Also: HyperlinkIconPosition
- **Breadcrumb** — Location within a page hierarchy (breadcrumbs, trail, path). Also: BreadcrumbItem
- **Tabs** — Switch between panels of related content (tabs, tab panel, segmented content, scroll spy). Not for: links to other pages → NavTabs. Also: CustomTab, Tab, TabPanel, TabPanelsContainer, TabScrollSpyPanel, TabsAlignment, TabsBorderPosition, TabsContainer, TabsIconPosition, TabsOrientation, TabsScrollSpyContainer, TabsTextTransform
- **NavTabs** — Tab-styled navigation between pages (nav tabs, page tabs, tab navigation). Also: NavTab
- **Pagination** — Page number navigation (pagination, pager, page numbers). Also: PageButtonSize, PaginationType
- **Stepper** — Progress through multi-step flows (stepper, wizard, steps, progress steps). Also: ResponsiveStepperContainer, Step, StepperLayout, StepperOrientation
- **TreeView** — Expandable hierarchical list with selection (tree, folder tree, nested list, hierarchy, file explorer). Also: TreeItem, TreeNodeType, TreeViewSelectable
- **AppBar** — Top header bar for the current screen (header, top bar, navbar, app header). Also: AppBarPosition
- **SkipLink** — Skip-to-main-content link and its target (skip link, skip navigation). Also: SkipLinkContent

### Layout
- **Container** — Centers content horizontally with max width (container, page wrapper, wrapper)
- **Flex** — Responsive 12-column flexbox rows and columns (flex, row, column, stack, responsive columns). Also: FlexAlignContent, FlexAlignItems, FlexBehavior, FlexDirection, FlexJustify, FlexWrap
- **Grid** — CSS grid container with grid props (grid, css grid, grid layout). Also: GridAlignContent, GridAlignItems, GridAutoFlow, GridDisplay, GridItem, GridItemAlignSelf, GridItemJustifySelf, GridJustifyContent, GridJustifyItems
- **Spacer** — Horizontal or vertical gap from the space scale (spacer, gap, margin, whitespace). Also: SpacerAxis
- **Card** — Surface for grouped content (card, tile, panel, box). Also: CardAlignment, CardBody, CardBorderRadius, CardCalloutType, CardCornerTreatment, CardHeading
- **Accordion** — Stacked collapsible sections (accordion, collapse, expandable section, faq). Also: AccordionButton, AccordionIconPosition, AccordionItem, AccordionPanel
- **BreakpointsContainer** — Render different content per screen size (responsive, breakpoint, mobile/desktop content). Also: Breakpoint, BreakpointScreenSize
- **HideAtBreakpoint** — Hide content above or below a breakpoint (hide on mobile, hide on desktop, responsive visibility). Also: HideAtBreakpointDisplayType

### Content and data
- **Typography** — Low-level typography primitive for custom text styles (typography, text style, styled text). Not for: semantic heading → Heading; paragraph → Paragraph. Also: TypographyColor, TypographyContextVariant, TypographyVisualStyle
- **Heading** — Headings h1–h6 (`level`), style set separately (heading, title, h1, h2)
- **Paragraph** — Body text with typography styles (paragraph, body text, text, copy)
- **List** — Ordered or unordered list, optional icons (list, bullet list, numbered list). Also: IconAlignment, IconSizes, ListItem
- **DefinitionList** — Term/description pairs (definition list, key value, details list, dl). Also: DefinitionListItem, DefinitionListType
- **BlockQuote** — Styled quotation with attribution (quote, blockquote, citation). Also: BlockQuoteItem
- **Table** — Composable table (rows, cells, sorting, pagination) (table, rows, columns, sortable table). Not for: table from data props → Datagrid. Also: TableBody, TableCell, TableCellAlign, TableDensity, TableHead, TableHeaderCell, TableHeaderCellScope, TablePagination, TableRow, TableRowColor, TableSortDirection
- **Datagrid** — Table rendered from columns/rows props, selection and pagination (data grid, data table, selectable rows)
- **Badge** — Small label or count (badge, counter, status label, pill). Also: BadgeColor, BadgeVariant, BadgeWeight
- **Tag** — Category chip, clickable or removable (tag, chip, filter chip, token). Also: TagColor, TagSize
- **Tagline** — Short, emphasized text that introduces or labels content (tagline, eyebrow, overline, section label)

### Utilities
- **VisuallyHidden** — Content for screen readers only (sr-only, screen reader text, visually hidden)
- **Announce** — aria-live region announcing dynamic changes (live region, aria-live, announce)
- **Transition** — framer-motion enter/exit animations (animation, fade, slide, collapse animation)

### Add-on packages
- **CarbonChart** (`@react-magma/charts`) — Accessible chart (`type`: bar, line, area, pie, donut, gauge, scatter…); `chartToolbar` adds table view, fullscreen and downloads (chart, graph, data visualization, bar chart, line chart, pie chart, dashboard). Also: CarbonChartType
- **ChartTable** (`@react-magma/charts`) — Parts for a custom chart toolbar and table view; prefer `CarbonChart` `chartToolbar` (chart toolbar, chart data table, fullscreen chart). Also: ChartDataTable, ChartFullscreenButton, ChartMoreOptionsButton, ChartTableButton, ChartTableModal, ChartToolbar
- **Dropzone** (`@react-magma/dropzone`) — Drag-and-drop file upload with previews, type/size/count limits and progress (file upload, drag and drop, dropzone, file input, attachment, uploader). Also: FileIcon

### Public hooks

Public hooks available for consumer use: `useDeviceDetect`, `useFocusLock`, `useMediaQuery`.

### Other public exports

`GlobalStyles`, `I18nContext`, `InverseContext`, `ThemeContext`, `defaultI18n`, `magma`, `styled`
