npm install react-ascii-ui
import { AsciiBadge } from 'react-ascii-ui'; export default function Example() { return ( <div> <AsciiBadge>Default</AsciiBadge> <AsciiBadge color="success">Success</AsciiBadge> <AsciiBadge variant="curly" color="primary">New</AsciiBadge> </div> ); }
<AsciiBadge>Badge</AsciiBadge>
<AsciiBadge color="default">Default</AsciiBadge> <AsciiBadge color="primary">Primary</AsciiBadge> <AsciiBadge color="success">Success</AsciiBadge> <AsciiBadge color="warning">Warning</AsciiBadge> <AsciiBadge color="error">Error</AsciiBadge>
<AsciiBadge variant="square">Square</AsciiBadge> <AsciiBadge variant="curly">Curly</AsciiBadge>
<div> <span>Server Status:</span> <AsciiBadge color="success">ONLINE</AsciiBadge> </div> <div> <span>Node.js App</span> <AsciiBadge variant="curly" color="primary">NEW</AsciiBadge> <AsciiBadge variant="curly" color="success">STABLE</AsciiBadge> </div>
Prop | Type | Default | Description |
---|---|---|---|
children | React.ReactNode | - | The content displayed inside the badge |
variant | 'square' | 'curly' | 'square' | Bracket style - square [text] or curly {text} |
color | 'default' | 'primary' | 'success' | 'warning' | 'error' | 'default' | Color theme of the badge |
className | string | "" | Additional CSS classes |
AsciiBadge extends all HTML span attributes and React.HTMLAttributes.