Repository navigation
ConfigurationCard
ConfigurationCard is a generic presentational card built on Carbon Tile. It renders a heading, optional body content, and an optional action button. The component has no router coupling — all navigation and external actions are delegated to the parent via the onButtonClick callback prop.
Use ConfigurationCard when a configuration or settings page needs a consistent card layout that surfaces a title, a short description (or custom content), and an optional action. Centralising this pattern in one component prevents each configuration page from re-implementing Carbon Tile layout and button wiring.
- Source:
frontend/src/components/core/ConfigurationCard/index.tsx - Tests:
frontend/src/components/core/ConfigurationCard/index.unit.test.tsx - Barrel:
frontend/src/components/core/index.ts - Issue: #906 — ConfigurationCard component
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
title |
string |
Yes | — | Card heading. |
description |
string | ReactNode |
No | — | Card body text or rich content. Rendered inside a <p> tag when provided. Ignored when children is also provided. |
children |
ReactNode |
No | — | Custom children rendered inside the tile. Takes priority over description when both are provided. |
buttonLabel |
string |
No | — | Button label text. Button is not rendered when this prop is absent. |
onButtonClick |
() => void |
No | — | Callback fired when the button is clicked. Button is not rendered when this prop is absent. |
kind |
ButtonProps['kind'] |
No | 'tertiary' |
Carbon Button kind passed directly to the underlying Button. |
disabled |
boolean |
No | false |
When true, the action button is rendered in a disabled state. |
- Renders a Carbon
Tilecontaining an<h4>heading. -
Content priority: when both
childrenanddescriptionare provided,childrenis rendered anddescriptionis ignored. -
Button rendering: the button is rendered only when both
buttonLabelandonButtonClickare provided. Providing one without the other suppresses the button entirely. - The
kindprop defaults to'tertiary'and is forwarded directly to CarbonButton. - The component is purely presentational; it owns no internal state and performs no navigation.
import { ConfigurationCard } from '@/components/core';
<ConfigurationCard
title="District average waste volumes"
description="View or manage district volume tables for each district."
buttonLabel="View or update tables →"
onButtonClick={() => navigate({ to: '/configuration/district-volume-tables' })}
/>When richer body content is needed, pass children instead of description. The button can be disabled independently while still rendering — useful for permission-gated actions.
import { ConfigurationCard } from '@/components/core';
import { InlineNotification } from '@carbon/react';
<ConfigurationCard
title="Annual submission targets"
buttonLabel="Edit targets"
onButtonClick={handleEdit}
kind="primary"
disabled={!canEdit}
>
<InlineNotification
kind="info"
subtitle="Targets are locked until the fiscal period opens."
hideCloseButton
/>
</ConfigurationCard>The component renders gracefully with only the required title prop.
<ConfigurationCard title="Feature under construction" />Current unit coverage (9/9 passing) verifies:
- Title rendering
-
descriptionrendering as a string -
childrentakes priority overdescriptionwhen both are provided - Button renders when both
buttonLabelandonButtonClickare provided -
onButtonClickis called once on button click - Button is suppressed when
onButtonClickisundefined - Button is suppressed when
buttonLabelisundefined -
kindprop is forwarded and reflected via CSS class -
disabledprop disables the button element
- The button is suppressed when either
buttonLabeloronButtonClickis omitted. Providing only one of the two is a valid no-button state, not an error. -
descriptionacceptsReactNodebut wraps it in a<p>tag. Passing block-level elements (e.g.<div>) will produce invalid HTML. Preferchildrenfor structured content. - The component has no internal loading state. Callers are responsible for rendering a skeleton or disabled variant while async data loads.
-
codes/frontend/Components.md— catalog entry points to this page. -
architecture/frontend/Frontend Architecture Overview.md— may reference the configuration page pattern.
This wiki documents NR Waste Plus for users and developers. Verify security and deployment guidance against the current application configuration before applying it elsewhere.
- Report an issue or ask a question in the GitHub repository.
- Follow the Contributing Guidelines to propose an update.
- Read the Code of Conduct.
Collection indexes support human browsing and machine retrieval. Keep both current when adding or moving wiki pages.
NR Waste Plus Wiki | GitHub Repository