# rn-awesome-card URL: /docs/native/kiva/awesome-card Multi-purpose stat card with an SVG pattern background, collapsible body and tap-to-expand modal, built as a compound component. ## Installation ```bash pnpm dlx @kivacore/ui-cli add @kivacore/rn-awesome-card ``` **Dependencies:** - [react-native-svg](https://www.npmjs.com/package/react-native-svg) - [react-native-reanimated](https://www.npmjs.com/package/react-native-reanimated) ## Usage ```tsx import { AwesomeCard, AwesomeCardHeader, AwesomeCardTitle, AwesomeCardIcon, AwesomeCardBody, AwesomeCardValue, AwesomeCardTrend, } from '@/components/kiva-native/awesome-card'; ``` ### Pattern The card draws a subtle tiled pattern behind its chrome (on by default, like web). Pick one of five motifs or turn it off. ```tsx ``` ### Collapsible ```tsx ``` ### Expandable `expandable` adds an expand button to the header. Tapping it presents the card in a centred modal with a scale-in animation (`expandSpeed` seconds). Inside the modal `AwesomeCardExpandedBody` replaces `AwesomeCardBody`; without an expanded body the regular body is shown instead. Tap the backdrop, the collapse button or the Android back button to close. ```tsx const [expanded, setExpanded] = useState(false); ``` ## API Reference ### AwesomeCard | Prop | Type | Default | Description | |------|------|---------|-------------| | `children` | `ReactNode` | - | Card content (sub-components) | | `pattern` | `boolean` | `true` | Draw the SVG pattern behind the card chrome | | `patternStyle` | `'stripes' \| 'dots' \| 'grid' \| 'crosshatch' \| 'zigzag'` | `'stripes'` | Pattern motif | | `collapsible` | `boolean` | `false` | Enable collapse toggle | | `collapsed` | `boolean` | `false` | Initial collapsed state (uncontrolled, same as web) | | `chevronPosition` | `'left' \| 'right'` | `'left'` | Position of the collapse chevron | | `expandable` | `boolean` | `false` | Show an expand button that presents the card in a modal | | `expandTrigger` | `'hover' \| 'click'` | `'click'` | Both expand on tap on native | | `expandDirection` | `'rt' \| 'rb' \| 'lt' \| 'lb'` | `'rb'` | Accepted for web parity; ignored on native | | `expandedWidth` | `number \| string` | `480` | Accepted for web parity; ignored on native | | `expandedHeight` | `number \| string` | `320` | Accepted for web parity; ignored on native | | `expanded` | `boolean` | - | Controlled expanded state | | `onExpandedChange` | `(expanded: boolean) => void` | - | Called when the expanded state changes | | `expandSpeed` | `number` | `0.35` | Expand animation duration in seconds (reduced motion skips it) | | `className` | `string` | - | Additional CSS classes | ### AwesomeCardHeader | Prop | Type | Default | Description | |------|------|---------|-------------| | `children` | `ReactNode` | - | Header content (Title, Icon) | | `className` | `string` | - | Additional CSS classes | ### AwesomeCardTitle | Prop | Type | Default | Description | |------|------|---------|-------------| | `children` | `ReactNode` | - | Title text (strings are styled automatically) | | `className` | `string` | - | Additional CSS classes | ### AwesomeCardIcon | Prop | Type | Default | Description | |------|------|---------|-------------| | `children` | `ReactNode` | - | Icon element | | `className` | `string` | - | Additional CSS classes | ### AwesomeCardBody | Prop | Type | Default | Description | |------|------|---------|-------------| | `children` | `ReactNode` | - | Body content (hidden while collapsed) | | `className` | `string` | - | Additional CSS classes | ### AwesomeCardExpandedBody | Prop | Type | Default | Description | |------|------|---------|-------------| | `children` | `ReactNode` | - | Content shown only in the expanded modal (scrollable) | | `className` | `string` | - | Classes for the scroll content container | ### AwesomeCardValue | Prop | Type | Default | Description | |------|------|---------|-------------| | `children` | `ReactNode` | - | Value (strings / numbers use tabular figures) | | `className` | `string` | - | Additional CSS classes | ### AwesomeCardTrend | Prop | Type | Default | Description | |------|------|---------|-------------| | `children` | `ReactNode` | - | Trend text | | `positive` | `boolean` | - | `true` → emerald, `false` → red, omitted → muted | | `className` | `string` | - | Additional CSS classes | ## Components | Component | Description | |-----------|-------------| | `AwesomeCard` | Root container (pattern, collapse and expand state) | | `AwesomeCardHeader` | Header row with chevron and expand button | | `AwesomeCardTitle` | Title text | | `AwesomeCardIcon` | Icon slot | | `AwesomeCardBody` | Collapsible body | | `AwesomeCardExpandedBody` | Body shown only in the expanded modal | | `AwesomeCardValue` | Large value text | | `AwesomeCardTrend` | Trend indicator | ## Type Exports | Type | Description | |------|-------------| | `AwesomeCardProps` | Props for AwesomeCard | | `AwesomeCardHeaderProps` | Props for AwesomeCardHeader | | `AwesomeCardTitleProps` | Props for AwesomeCardTitle | | `AwesomeCardIconProps` | Props for AwesomeCardIcon | | `AwesomeCardBodyProps` | Props for AwesomeCardBody | | `AwesomeCardExpandedBodyProps` | Props for AwesomeCardExpandedBody | | `AwesomeCardValueProps` | Props for AwesomeCardValue | | `AwesomeCardTrendProps` | Props for AwesomeCardTrend | | `ExpandDirection` | `'rt' \| 'rb' \| 'lt' \| 'lb'` (web parity, ignored) | | `PatternStyle` | `'stripes' \| 'dots' \| 'grid' \| 'crosshatch' \| 'zigzag'` |