Card
A container component that displays content in a card-like layout with elevation.
Installation
npm install @cleartrip/ct-design-card
# or
pnpm add @cleartrip/ct-design-card
Peer dependencies
# Required for all targets
npm install react
# Web only
npm install react-dom
# React Native only
npm install react-native
Usage
Basic
import { Card } from '@cleartrip/ct-design-card';
function Example() {
return (
<Card>
{/* Basic usage */}
</Card>
);
}
Props
| Prop | Type | Default | Required | Description |
|---|---|---|---|---|
borderWidth | CardBorderWidthType | — | No | Set border width of card. Defaults to 'md'. |
cornerRadius | CardRadiusType | — | No | Set the radius of card corners. Defaults to 'md'. |
showShadow | boolean | — | No | Show shadow on the card. Defaults to true. |
shadowDirection | CardShadowDirectionType | — | No | Direction of the shadow. Defaults to 'top' (web only — RN uses standard |
shadowVariant | CardShadowVariantType | — | No | Variant of the shadow. Maps to the theme elevation tokens. Defaults to |
borderDirection | CardBorderDirectionType | — | No | Direction of the border. Defaults to 'default' (all sides). |
noBorder | boolean | — | No | When true, skips rendering the border but keeps the rounded corners. |
children | ReactNode | — | No | Content rendered inside the card. |
styleConfig | ICardStyleConfig | — | No | Style configuration overrides for the root container. |
onClick | IContainer['onClick'] | — | No | Callback fired when the card is clicked or pressed. |
onLayout | IContainer['onLayout'] | — | No | Callback fired when the card is layout changed. |
CardRadius
NONE— noneSMALL— smMEDIUM— mdLARGE— lgEXTRA_LARGE— xl
CardBorderWidth
NONE— noneSMALL— smMEDIUM— mdLARGE— lg
CardShadowDirection
TOP— topBOTTOM— bottom
CardShadowVariant
E1— E1E2— E2E3— E3E4— E4
CardBorderDirection
TOP— topBOTTOM— bottomLEFT— leftRIGHT— rightDEFAULT— default
Accessibility
- The component follows accessibility best practices
- Ensure proper ARIA attributes are provided where needed
- Test with screen readers to ensure usability
Migration
If migrating from a previous version:
- import { Card } from 'yagami/core/components';
+ import { Card } from '@cleartrip/ct-design-card';