Skip to content

Tile ​

One thing to start with, drawn as a card that is a button. A start screen and the empty places of an app use it, so a place to begin looks the same wherever it is offered.

tsx
import { Tile } from '@basmilius/react-ui';
tsx
import { FolderOpen, Plus, Terminal } from 'lucide-react';
import { Icon, Tile, shortcut } from '@basmilius/react-ui';

const NEW = shortcut('Mod+N');
const OPEN = shortcut('Mod+O');

export default function TileDemo() {
    return (
        <div className="grid w-full max-w-xl grid-cols-2 gap-2">
            <Tile primary icon={<Icon icon={Plus} />} title="New project" description="Start from an empty folder" shortcut={NEW} />
            <Tile icon={<Icon icon={FolderOpen} />} title="Open a folder" description="Anything on this computer" shortcut={OPEN} />
            <Tile icon={<Icon icon={Terminal} />} title="Open a terminal" size="sm" />
            <Tile icon={<Icon icon={Terminal} />} title="Waiting for a connection" description="Try again once it is back" disabled size="sm" />
        </div>
    );
}

Give one tile on a screen primary, and its border and its icon take the accent. sm is for a narrow column like a sidebar. The description is one short line, such as where the action lands or why it waits, and it truncates rather than wraps.

Props ​

Tile takes every prop of a <button> except title, plus:

PropTypeDefault
iconReactNodeRequired. A 16 pixel Icon.
titlestringRequired.
descriptionReactNodeOne line under the title.
shortcutShortcutPrinted at the end of the tile.
primarybooleanfalse
size'md' | 'sm''md'

TileProps is an exported type.