ASCII Shapes
boldkit/ascii-shapesFreeComponent
7 animated ASCII art components (Spiral, Rose, Wave, Vortex, Pulse, Matrix, Grid) with 5 character sets, 4 sizes, and SSR-safe static mode
Live preview
live · rendered by the registry
Rendered by boldkit on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://boldkit.dev/r/ascii-shapes.jsonSource
1import * as React from 'react'2import { cn } from '@/lib/utils'34// ============================================================================5// Types6// ============================================================================78export type AsciiSize = 'sm' | 'md' | 'lg' | 'hero'9export type AsciiCharset = 'blocks' | 'braille' | 'classic' | 'line' | 'dots'10export type AsciiSpeed = 'slow' | 'normal' | 'fast'1112export interface AsciiShapeProps extends React.HTMLAttributes<HTMLPreElement> {13 size?: AsciiSize14 charset?: AsciiCharset15 color?: string16 speed?: AsciiSpeed17 animated?: boolean18 multicolor?: boolean19}2021// ============================================================================22// Constants23// ============================================================================2425const SIZE_MAP: Record<AsciiSize, { cols: number; rows: number }> = {26 sm: { cols: 24, rows: 12 },27 md: { cols: 48, rows: 24 },28 lg: { cols: 72, rows: 36 },29 hero: { cols: 120, rows: 60 },30}3132const CHARSETS: Record<AsciiCharset, string[]> = {33 blocks: [' ', '░', '▒', '▓', '█'],34 braille: [' ', '⠁', '⠃', '⠇', '⠿', '⠷'],35 classic: [' ', '.', ':', 'o', '*', '#', '@'],36 line: [' ', '-', '/', '|', '\\', '+', 'X'],37 dots: [' ', '.', '·', '•', '●'],38}3940const SPEED_MAP: Record<AsciiSpeed, number> = {41 slow: 0.4,42 normal: 1.0,43 fast: 2.2,44}4546const MULTICOLOR_PALETTE = [47 'hsl(var(--primary))',48 'hsl(var(--secondary))',49 'hsl(var(--accent))',50 'hsl(var(--warning))',51 'hsl(var(--info))',52 'hsl(var(--success))',53]5455// ============================================================================56// Grid engine57// ============================================================================5859function makeGrid(cols: number, rows: number): string[][] {60 return Array.from({ length: rows }, () => Array(cols).fill(' '))61}6263function gridToLines(grid: string[][]): string[] {64 return grid.map((row) => row.join(''))65}6667// ============================================================================68// Draw functions69// ============================================================================7071function drawSpiral(grid: string[][], cols: number, rows: number, t: number, chars: string[]): void {72 const cx = cols / 2, cy = rows / 273 const aspect = 2.074 const spacing = Math.min(cx * aspect, cy) * 0.357576 for (let r = 0; r < rows; r++) {77 for (let c = 0; c < cols; c++) {78 const dx = (c - cx) * aspect79 const dy = r - cy80// … truncated
What it pulls in
Other registry items
Files it writes
More from boldkit
All 94 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | boldkit | Components | Free | 2 deps | |
| Alertalert | boldkit | Components | Free | 2 deps | |
| Alert Dialogalert-dialog | boldkit | Components | Free | 1 dep | |
| Aspect Ratioaspect-ratio | boldkit | Components | Free | 1 dep | |
| Avataravatar | boldkit | Components | Free | 1 dep | |
| Badgebadge | boldkit | Components | Free | 1 dep | |
| Breadcrumbbreadcrumb | boldkit | Components | Free | 2 deps | |
| Buttonbutton | boldkit | Components | Free | 2 deps |
