# Icons

Phosphor by default, with the freedom to use any icon pack.

Zenos uses **Phosphor Icons by default** in its documentation and examples. This is a starting point, not a requirement: **you can use any icon pack you like**, or your own SVGs.

Icons are supplied by your application. Zenos does not require Phosphor as a core dependency or wrap icons in a pack-specific API.

## Default icon set

Phosphor provides a consistent visual language for navigation, actions, and feedback. These are a few of the icons used in product interfaces:

## Install Phosphor

Add the React package to your application if you want to use the default set:

```bash
pnpm add @phosphor-icons/react
npm install @phosphor-icons/react
yarn add @phosphor-icons/react
bun add @phosphor-icons/react
```

Import individual icon components and compose them with Zenos controls:

```tsx
import { PlusIcon, TrashIcon } from "@phosphor-icons/react";
import { Button, IconButton } from "@zentara-co/zenos-ui";

function ProjectActions() {
  return (
    <>
      <Button startIcon={<PlusIcon aria-hidden="true" />}>Create project</Button>
      <IconButton aria-label="Delete project">
        <TrashIcon aria-hidden="true" />
      </IconButton>
    </>
  );
}
```

Use `startIcon` or `endIcon` for [Button](/components/button/) labels, and place the icon inside [IconButton](/components/icon-button/) for icon-only actions.

## Weights

Phosphor supports six weights. Start with `regular` for everyday interface icons and keep the treatment consistent across a feature. A filled icon can distinguish a selected or saved state, but should not be the only indication of that state.

```tsx
import { StarIcon } from "@phosphor-icons/react";

<StarIcon size={32} weight="regular" aria-hidden="true" />;
```

The same icon can use `thin`, `light`, `regular`, `bold`, `fill`, or `duotone`. Weight is an icon-library option, not a Zenos component prop.

## Use any icon pack

Replace the Phosphor component with an icon from your preferred library. The Zenos composition stays the same; only the icon import and any library-specific props change. You do not need to install Phosphor alongside another pack.

Custom SVG components work too:

```tsx
import type { SVGProps } from "react";
import { IconButton } from "@zentara-co/zenos-ui";

function AddIcon(props: SVGProps<SVGSVGElement>) {
  return (
    <svg
      viewBox="0 0 24 24"
      width="1em"
      height="1em"
      fill="none"
      stroke="currentColor"
      strokeWidth={1.5}
      {...props}
    >
      <path d="M12 5v14M5 12h14" />
    </svg>
  );
}

function AddAction() {
  return (
    <IconButton aria-label="Add item">
      <AddIcon aria-hidden="true" />
    </IconButton>
  );
}
```

## Size and color

- Let Zenos controls handle their icon sizing where possible; use your icon library's sizing props for standalone icons.
- Prefer `currentColor` so icons inherit the surrounding foreground, including hover, disabled, and dark-mode treatments.
- Use [semantic color roles](/foundations/colors/) such as `--icon-default`, `--icon-subtle`, or `--icon-danger` for standalone icons rather than fixed colors.
- Keep stroke weight, optical size, and alignment consistent. Different icon packs can have different view boxes and proportions.

## Accessibility

- Hide decorative icons with `aria-hidden="true"` when visible text already explains their meaning.
- Give every icon-only control an accessible name, such as `aria-label="Delete project"`, on the control rather than only on its icon.
- Pair status icons with text. Do not rely on an icon shape or color alone to communicate success, warning, or error.
- For a meaningful standalone SVG without accompanying text, provide `role="img"` and an accessible name.
- Mirror directional icons for right-to-left layouts only when their meaning is directional; do not mirror logos or universal symbols indiscriminately.

Source: https://zenos-ui.pages.dev/foundations/icons/