Playground

Overview

Monoline has no icon dependency. Icons are inline SVG that follow the text colour, passed as children.

Installation

There is nothing to install. An icon is an inline SVG that uses currentColor, so it follows the text colour and the theme.

Usage

Pass it as children. Decorative icons get aria-hidden; an icon-only button needs an aria-label.

icon-button.tsx
import {IconButton} from '@monoline/react';

<IconButton aria-label="Search">
  <svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" strokeWidth="1.5" aria-hidden="true">
    <path d="M7 2.5a4.5 4.5 0 1 0 0 9 4.5 4.5 0 0 0 0-9ZM10.5 10.5 14 14" />
  </svg>
</IconButton>

Bring any set you like (Lucide, Phosphor, your own). Use a 1.5 stroke to match the thin rules. Browse the icons library.

Props

An icon is your own SVG, so it takes the SVG attributes. These are the ones to set every time.

  • width and height: 16 inside buttons and inputs, 24 on their own.
  • stroke="currentColor" and strokeWidth="1.5": follow the text colour and the thin rules.
  • aria-hidden="true" when decorative, or role="img" with aria-label when it carries meaning.