UI.MD

Header Icon Button

An icon-only control for bare header chrome, with no fill: a GitHub or social link, a menu toggle.

Installation

$
npx shadcn@latest add https://ui.mattdowney.com/r/header-icon-button.json

Usage

import { HeaderIconButton } from "@/components/ui/header-icon-button"

Examples

Links and a menu toggle

Pass render={<a href="..." />} for a link; with no render it is a button. Every one needs an aria-label, since the glyph is all there is.

Sizes

24, 32 and 40px boxes, the same rows as Button's icon sizes, with a 16, 20 or 24px glyph.

API Reference

PropTypeDefaultDescription
size"sm" | "default" | "lg""default"Box 24 / 32 / 40px, glyph 16 / 20 / 24px. A coarse pointer gets a 44px hit area without the box growing.
renderReact.ReactElement-The element to draw, such as <a href="..." /> or a router <Link />. Defaults to a button.
childrenReact.ReactNode-One icon. Its size comes from size, so leave the icon's own size unset.
size"sm" | "default" | "lg" = "default"Box 24 / 32 / 40px, glyph 16 / 20 / 24px. A coarse pointer gets a 44px hit area without the box growing.
renderReact.ReactElementThe element to draw, such as <a href="..." /> or a router <Link />. Defaults to a button.
childrenReact.ReactNodeOne icon. Its size comes from size, so leave the icon's own size unset.