A React component for rendering ASCII text art.
npm install better-asciiimport { Ascii } from 'better-ascii';
function App() {
return <Ascii>Hello World</Ascii>;
}import { Ascii, fonts } from 'better-ascii';
function App() {
return (
<div>
<Ascii font={fonts.ansiShadow}>Shadow</Ascii>
<Ascii font={fonts.alpha}>Alpha</Ascii>
<Ascii font={fonts.deltaCorpsPriest1}>Delta</Ascii>
</div>
);
}import { Ascii, fonts } from 'better-ascii';
function App() {
return (
<Ascii
font={fonts.ansiShadow}
className="text-green-400 bg-black p-4"
>
Styled
</Ascii>
);
}| Prop | Type | Default | Description |
|---|---|---|---|
children |
string |
required | The text to render as ASCII art |
font |
Font |
Delta Corps Priest 1 | Font to use (import from fonts) |
className |
string |
undefined |
CSS classes to apply |
style |
CSSProperties |
undefined |
Inline styles (merged with defaults) |
...props |
HTMLAttributes<HTMLPreElement> |
- | All standard <pre> attributes |
fonts.ansiShadowfonts.deltaCorpsPriest1(default)fonts.alpha
role="img"witharia-labelon rendered outputaria-busy="true"during loadingrole="alert"for errors
Works with the App Router out of the box — "use client" is included in the bundle.
npm install
npm run build
npm run dev # watch modeMIT
