npm.io
5.32.0 • Published 6d ago

@cleartrip/ct-design-card

Licence
ISC
Version
5.32.0
Deps
5
Size
80 kB
Vulns
0
Weekly
0

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 — none
  • SMALL — sm
  • MEDIUM — md
  • LARGE — lg
  • EXTRA_LARGE — xl

CardBorderWidth

  • NONE — none
  • SMALL — sm
  • MEDIUM — md
  • LARGE — lg

CardShadowDirection

  • TOP — top
  • BOTTOM — bottom

CardShadowVariant

  • E1 — E1
  • E2 — E2
  • E3 — E3
  • E4 — E4

CardBorderDirection

  • TOP — top
  • BOTTOM — bottom
  • LEFT — left
  • RIGHT — right
  • DEFAULT — 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';