Toast
A temporary notification component that appears briefly.
Installation
npm install @cleartrip/ct-design-toast
# or
pnpm add @cleartrip/ct-design-toast
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 { Toast } from '@cleartrip/ct-design-toast';
function Example() {
return (
<Toast>
{/* Basic usage */}
</Toast>
);
}
Props
| Prop | Type | Default | Required | Description |
|---|---|---|---|---|
show | boolean | — | Yes | show property |
text | `string | ReactNode` | — | Yes |
borderSize | ``${IToastBorderSize` | — | No | borderSize property |
IToastBorderSize
XS— xsSM— smMD— mdLG— lgXL— xl
IToastPosition
TOP— topBOTTOM— bottomBOTTOM_CENTER— bottom_center
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 { Toast } from 'yagami/core/components';
+ import { Toast } from '@cleartrip/ct-design-toast';