Navigation

v1.0.0
Frameworks

Preact

Render dynamic or fixed optical drawings in Preact.

On this page

#Dynamic icons

Preact is a required peer dependency. Install Preact 11 in your application and install @master/icons-preact.

import { SearchIcon } from '@master/icons-preact';<SearchIcon size={20} corner="rounded" label="Search" />

The dynamic entry includes all nine optical size and corner combinations, along with their supported stroke widths, for each imported icon. It shares the same geometry as the other frameworks and SVG. size selects the nearest optical drawing; corner defaults to soft.

#Fixed icons

import { SearchIcon } from '@master/icons-preact/16/soft';<button aria-label="Search"><SearchIcon /></button>

Fixed entries include only one optical size and corner style. Replace 16/soft with any combination of 16, 20, 24 and sharp, soft, rounded. Fixed components do not accept corner or opticalSize; size only scales the selected drawing.

#Framework behavior

Use your application’s Preact JSX configuration. Components accept SVG props, event handlers and SVG refs. This entry uses Preact directly and does not require React.

Unlabeled icons are decorative. Use label, aria-label or aria-labelledby for a meaningful icon, or label the enclosing button. See accessibility.

#Custom stroke width

Both entries accept strokeWidth, in native units and steps of 0.25. It selects redrawn geometry rather than changing the SVG stroke attribute.

import { SearchIcon } from '@master/icons-preact/24/soft';<SearchIcon size={48} strokeWidth={2} />

See stroke width for the range of each optical size and how widths are drawn.