Skip to content

Logo

Renders static text or caller-provided ASCII art without loading figlet from the default component export.

Preview

Installation

$pnpm exec dgadd add ui/logo
[Installs to]src/components/ui/logo[Item]ui/logo

dgadd is not public on npm yet. Until the first release, pack @diffgazer/add from the repository and install that tarball into this app, which is what puts dgadd on pnpm exec.

UI components require Tailwind CSS v4. Local copy mode imports src/styles/styles.css; package mode uses @diffgazer/ui CSS once packages are available.

Info:

The base Logo item stays figlet-free. Package consumers can import the optional helper from @diffgazer/ui/components/logo/figlet. Copy, dgadd, and direct registry consumers install the separate ui/logo-figlet item (dgadd add ui/logo-figlet) to get the helper source.

Usage

tsx
import { Logo } from "@/components/ui/logo";const DG_MARK = " ____   ____ \n|  _ \\ / ___|\n| | | | |  _ \n| |_| | |_| |\n|____/ \\____|";export default function LogoDefault() {  return (    <div className="space-y-6">      <Logo text="DG" asciiText={DG_MARK} className="text-foreground text-sm" />      <Logo text="diffgazer" className="text-foreground" />    </div>  );}

Figlet integration

The optional getFigletText helper generates ASCII art at runtime using the figlet library. It is available at @diffgazer/ui/components/logo/figlet in package mode. Copy, dgadd, and direct registry consumers add ui/logo-figlet and import from the copied @/components/ui/logo/figlet module. The helper supports two fonts: "Big" and "Small".

tsx
import { getFigletText } from "@diffgazer/ui/components/logo/figlet"

const ascii = await getFigletText("DG", "Big")

figlet is an optional peer dependency. Install it with npm install figlet @types/figlet before using getFigletText.

ASCII art has a fixed column count, so it does not reflow. Scale the font size from the container width instead of setting a fixed text-* class — for example clamp(), a container query, or the measured container width divided by the art's column count. Logo clips accidental overflow inside itself (max-w-full overflow-hidden) so it never scrolls the page horizontally.

Examples

ASCII Text

Preview

Styled

Preview

Figlet Integration

Preview

API Reference

NameTypeDefaultDescription
textrequiredstringDisplay text, also used as the accessible name when asciiText is provided.
asciiTextstringPrecomputed ASCII art. When set, renders inside <pre role="img" aria-label={text}>.

Accessibility

Notes

ASCII Text

Precompute ASCII art and pass it through asciiText. The Logo component itself never imports figlet, so consumers stay in control of the ASCII source.

Optional figlet helper

The Logo component stays figlet-free by default. Package consumers can import the optional helper from @diffgazer/ui/components/logo/figlet. Copy, dgadd, and direct registry consumers can add the separate ui/logo-figlet item; it installs the helper source and declares figlet as an optional runtime dependency.

Sizing

ASCII output can be large. Use small text sizes (text-[6px] to text-2xs) and responsive sizing to fit it in your layout.

Source

Install via CLI: pnpm exec dgadd add ui/logo.

Highlighted source loads after this disclosure opens. Browse the source repository.