Types reference

The package only exports types that describe your data (options, columns, marks, preset keys, toast payloads, etc.). Component prop interfaces (ButtonProps, TableProps, SliderProps, …) are intentionally internal, if you ever need them in TypeScript, use React.ComponentProps<typeof Button> (or the specific component) instead.

Types are recommended to be imported from h2o-library/types so bundlers can elide them cleanly. The same symbols are also available from the root entry when convenient:

import type { TableColumn, SortDirection, TabItem } from "h2o-library/types";
import type { TableColumn, SortDirection, TabItem } from "h2o-library";

Tables

SortDirection

export type SortDirection = "asc" | "desc" | null;
MemberTypeDescription
(union)"asc" | "desc" | nullSort direction for Table. null means unsorted.

TableColumn<T>

export interface TableColumn<T> {
  key: string;
  label: string;
  sortable?: boolean;
  minWidth?: string;
  maxWidth?: string;
  width?: string;
  render?: (value: unknown, row: T) => React.ReactNode;
}
MemberTypeDescription
keystringField key on each row object.
labelstringHeader label.
sortablebooleanWhen true, column participates in sorting.
minWidthstringOptional CSS min-width for the column.
maxWidthstringOptional CSS max-width for the column.
widthstringOptional CSS width for the column.
render(value, row) => ReactNodeCustom cell content; receives cell value and full row.

ExpandableTableColumn<T>

export interface ExpandableTableColumn<T> {
  key: string;
  label: string;
  sortable?: boolean;
  minWidth?: string;
  maxWidth?: string;
  width?: string;
  render?: (value: unknown, row: T) => React.ReactNode;
}
MemberTypeDescription
keystringField key on each row object.
labelstringHeader label.
sortablebooleanWhen true, column participates in sorting.
minWidthstringOptional CSS min-width for the column.
maxWidthstringOptional CSS max-width for the column.
widthstringOptional CSS width for the column.
render(value, row) => ReactNodeCustom cell content; receives cell value and full row.

Options & items

export interface DropdownOption {
  label: string;
  value: string;
  disabled?: boolean;
}
MemberTypeDescription
labelstringVisible label in the list.
valuestringSubmitted / controlled value.
disabledbooleanDisables the option.

MultiSelectOption

export interface MultiSelectOption {
  label: string;
  value: string;
}
MemberTypeDescription
labelstringChip / list label.
valuestringStable option value.

CompactMultiSelectOption

export interface CompactMultiSelectOption {
  label: string;
  value: string;
  disabled?: boolean;
}
MemberTypeDescription
labelstringVisible text.
valuestringStable id in the selection payload.
disabledbooleanGreys out or skips the option.

RadioOption

export interface RadioOption {
  label: string;
  value: string;
  icon?: IconType;
  dot?: "active" | "inactive";
  disabled?: boolean;
  tooltip?: string;
  tooltipPosition?: TooltipPosition;
}
MemberTypeDescription
labelstringOption title.
valuestringEmitted to onChange when selected.
iconIconTypeOptional leading icon.
dot"active" | "inactive"Status dot when no icon.
disabledbooleanDisables the option.
tooltipstringTooltip on the option row.
tooltipPositionTooltipPositionTooltip placement.

SliderMark

export type SliderMark = { value: number; label?: string };
MemberTypeDescription
valuenumberPosition on the slider scale.
labelstringOptional tick label.

MultiMenuItem

export interface MultiMenuItem {
  label: string;
  value: string;
  onClick?: () => void;
  disabled?: boolean;
  subItems?: MultiMenuItem[];
}
MemberTypeDescription
labelstringMenu item label.
valuestringUnique id among siblings.
onClick() => voidInvoked when the item is activated (no sub-menu).
disabledbooleanDisables the item.
subItemsMultiMenuItem[]Nested fly-out items.

TabItem

export type TabItem = {
  label: string;
  value: string;
  disabled?: boolean;
};
MemberTypeDescription
labelstringTab label.
valuestringSelected tab value.
disabledbooleanDisables the tab.

ContentSwitchOption

export type ContentSwitchOption = {
  label: string;
  value: string;
  icon?: IconType;
  disabled?: boolean;
};
MemberTypeDescription
labelstringSegment label.
valuestringSegment value.
iconIconTypeOptional leading icon.
disabledbooleanDisables the segment.

SegmentedToggleOption

export type SegmentedToggleOption = {
  label: string;
  value: string;
  icon?: IconType;
  iconProps?: React.SVGProps<SVGSVGElement> & {
    size?: number;
    strokeWidth?: number;
  };
  labelProps?: React.HTMLAttributes<HTMLSpanElement>;
  disabled?: boolean;
};
MemberTypeDescription
labelstringSegment label.
valuestringSegment value.
iconIconTypeOptional icon name.
iconPropsSVGProps<SVGSVGElement> & …Forwarded to the segment icon (size, strokeWidth, SVG attrs).
labelPropsHTMLAttributes<HTMLSpanElement>Props for the label span.
disabledbooleanDisables the segment.

LegendItem

export type LegendItem = {
  label: string;
  color: string;
  style?: LegendStyle;
};
MemberTypeDescription
labelstringLegend entry label.
colorstringSwatch color (CSS color).
onClick() => voidOptional click handler on the legend item.
styleLegendStyleSwatch shape: line, dashed-line, rectangle, circle.

ChartKPI

export type ChartKPI = {
  label: string;
  value: string | number;
};
MemberTypeDescription
labelstringKPI label.
valuestring | numberKPI value.

ChartType & ChartProps

export type ChartType = "bar" | "line" | "pie" | "heatmap";

export type ChartProps<T extends ChartType> = BaseChartProps & {
  data: BaseChartData[T];
} & (T extends "bar" ? BarChartSpecificProps : Record<string, never>);
MemberTypeDescription
ChartType"bar" | "line" | "pie" | "heatmap"Discriminant for the combined Chart component.
dataBarChartDataPoint[] | LineChartDataPoint[] | …Shape depends on type; import point types from h2o-library/charts.
layout / orientation / …bar-onlyWhen type is "bar", extra props such as layout, orientation, rotateLabels, wrapLabels apply.

CalendarMode

export type CalendarMode = "single" | "range";
MemberTypeDescription
(union)"single" | "range"Selection mode for Calendar.

ToastOptions

export interface ToastOptions {
  variant: ToastVariant;
  title: string;
  description?: string;
  primaryAction?: { label: string; action: () => void };
  secondaryAction?: { label: string; action: () => void };
  duration?: number;
}
MemberTypeDescription
variantToastVariantToast style.
titlestringHeading.
descriptionstringBody text.
primaryAction{ label; action }Primary button.
secondaryAction{ label; action }Secondary button.
durationnumberAuto-dismiss ms; 0 disables.

Variants And Presets

Preset (DateRangePicker)

export type Preset =
  | "today"
  | "last_7_days"
  | "last_30_days"
  // …and other built-in preset keys
  | "custom";
MemberTypeDescription
(union)string literal unionBuilt-in range shortcuts for DateRangePicker. See source for the full list.

ToastVariant & ToastPosition

export type ToastVariant = "info" | "error" | "warning" | "success";

export type ToastPosition =
  | "top-right"
  | "top-left"
  | "bottom-right"
  | "bottom-left"
  | "top-center"
  | "bottom-center";
MemberTypeDescription
ToastVariant"info" | "error" | "warning" | "success"Visual style for showToast.
ToastPositionstring unionToastProvider placement.

MessageVariant

export type MessageVariant = "info" | "muted" | "error" | "warning" | "success";
MemberTypeDescription
(union)string unionMessage visual variant.

TooltipPosition

export type TooltipPosition = "top" | "bottom" | "left" | "right";
MemberTypeDescription
(union)string unionPreferred tooltip placement.

IconType

export type IconType =
  | "plus"
  | "minus"
  | "chevron-right"
  // …full union in h2o-library (see Icon docs)
  | "alert-triangle";
MemberTypeDescription
(union)string literalsAll supported icon names. Import from h2o-library / h2o-library/types; see the [Icon](/docs/components/icon) page for the complete set.