Banner
Page-level persistent message across the top of a page or section.
Code
import * as React from 'react';
import { Banner, Link } from '@fruit-labs/design';
export default function Demo() {
return (
<div
style={{
display: 'flex',
flexDirection: 'column',
gap: 10,
}}
>
<Banner tone="warning" action={<Link href="#">Update</Link>}>
<b>Payment failed.</b>
{' Update your card to keep your plan.'}
</Banner>
<Banner onDismiss={() => {}}>New: dark mode is here.</Banner>
</div>
);
}Install
From npm:
npm install @fruit-labs/design
import { Banner } from '@fruit-labs/design';Or copy the TypeScript source into your project:
npx shadcn@latest add https://design.fruitlabs.online/r/banner.jsonGuidelines
- Use for account or system state (payment failed, maintenance). Offer one action.
Props
| Prop | Type | Required |
|---|---|---|
tone | 'info' | 'success' | 'warning' | 'danger' | No |
icon | string | No |
action | React.ReactNode | No |
onDismiss | () => void | No |
className | string | No |
children | React.ReactNode | No |