EnterUI
DocsComponentsThemesExamplesDonation
Get Started
      • Legend

Default usage

  1. EnterUI
  2. /Docs
  3. /Data and Analytics
  4. /Metrics and Charts
  5. /Chart Primitives
  6. /Legend
Updated 9 October 2026

Legend

Small labelled-swatch list used to caption charts and dashboards.

Legend renders a list of labelled swatches with optional values. Its larger, softly rounded swatches follow the shared blue and aqua chart palette. Use it next to a DonutChart, BarChart, or Sparkline to caption colour mappings.

#Default usage

Inline legend

Horizontal layout pairs colour with label and optional value.

  • Stable62%
  • Beta28%
  • Alpha10%
Code
<Legend
  items={[
    { label: "Stable", value: "62%" },
    { label: "Beta", value: "28%" },
    { label: "Alpha", value: "10%" },
  ]}
/>

#Import

Code
import { Legend } from "@froggdesign/enter-ui-react";

#Patterns

Portfolio composition

A segmented donut and share bars use matching series colors.

BTC: 49.7ETH: 21.6SOL: 13.8USDC: 9.2AVAX: 5.75 assets
  • BTC49.7%
  • ETH21.6%
  • SOL13.8%
  • USDC9.2%
  • AVAX5.7%

#Accessibility

Legend renders a semantic <ul> of labelled items. Swatches are aria-hidden so screen readers focus on the labels and values.

#API

  • variant: default (swatches) or bars (full-width share rows using the segmented donut palette).

  • items[].share: numeric percentage of the whole; bars clamp to 0–100 and treat non-finite values as zero. Supply value for the visible percentage. Decorative bars are hidden from screen readers.

  • items: array of { label, value?, color? } entries.

  • orientation: horizontal (default) or vertical.

  • Extends ul props.

#Styling

Every exported component accepts className when it renders an element. EnterUI styles use .eui-* classes and --eui-* variables mapped from FroggDesign theme tokens.

PreviousComparisonMetric
NextUserMenu
On this page
  • Default usage
  • Import
  • Patterns
  • Accessibility
  • API
  • Styling