A collection of retro-styled React components that bring the aesthetic of classic terminal interfaces to modern web applications.
Perfect for developers who want to create nostalgic, hacker-style interfaces or command-line inspired web apps.
import React, { useState } from 'react';
import { AsciiButton, AsciiInput } from 'react-ascii-ui';
interface AppProps {
defaultName?: string;
}
const App: React.FC<AppProps> = ({ defaultName = '' }) => {
const [name, setName] = useState<string>(defaultName);
const handleClick = (): void => {
alert(`Hello, ${name}!`);
};
return (
<div>
<AsciiInput
value={name}
onChange={(e) => setName(e.target.value)}
placeholder="Enter your name"
/>
<AsciiButton onClick={handleClick}>
Say Hello
</AsciiButton>
</div>
);
};npm install react-ascii-ui
import { AsciiTabs } from 'react-ascii-ui';
const tabs = [
{
label: "Tab 1",
content: <div>Content for first tab</div>
},
{
label: "Tab 2",
content: <div>Content for second tab</div>
}
];
export default function Example() {
return <AsciiTabs tabs={tabs} />;
}const tabs = [
{ label: "Home", content: "Welcome to the home page!" },
{ label: "About", content: "Learn more about our project." },
{ label: "Contact", content: "Get in touch with us." }
];
<AsciiTabs tabs={tabs} /><AsciiTabs
tabs={tabs}
defaultTab={1} // Second tab starts active
/>const tabs = [
{ label: "Available", content: "This tab is available" },
{ label: "Disabled", content: "Hidden content", disabled: true },
{ label: "Active", content: "This tab is clickable" }
];
<AsciiTabs tabs={tabs} />const tabs = [
{
label: "Dashboard",
content: (
<div>
<h4>System Status</h4>
<div>CPU Usage: 45%</div>
<div>Memory: 2.3GB</div>
</div>
)
},
{
label: "Alerts",
content: (
<AsciiAlert variant="warning" title="System Alert">
Disk space is running low
</AsciiAlert>
)
}
];| Prop | Type | Default | Description |
|---|---|---|---|
| tabs | AsciiTab[] | - | Array of tab objects to display |
| defaultTab | number | 0 | Index of tab that should be active initially |
| onTabChange | (index: number) => void | - | Callback fired when active tab changes |
| className | string | "" | Additional CSS classes |
| Property | Type | Required | Description |
|---|---|---|---|
| label | string | Yes | Text displayed on the tab header |
| content | React.ReactNode | Yes | Content to show when tab is active |
| disabled | boolean | No | Whether the tab is disabled and unclickable |
AsciiTabs extends all HTML div attributes and React.HTMLAttributes.