Tài liệu

Platform icons

@sota/platform/icons expose các icon name ổn định: alert, check, chevronDown, chevronLeft, chevronRight, close, info, loading, search, settings, warning.

TSX
import { Icon, PLATFORM_ICON_NAMES, type IconName } from '@sota/platform/icons';

export function StatusIcon({ name, label }: { name: IconName; label: string }) {
  return <span>
    <Icon name={name} size={16} strokeWidth={2} aria-hidden />
    <span>{label}</span>
  </span>;
}

console.log(PLATFORM_ICON_NAMES);

Icon nhận SVG attributes thông thường. Dùng aria-hidden khi text bên cạnh đã đặt tên; nếu icon đứng một mình thì truyền aria-label. Union tên icon đóng để TypeScript bắt tên không tồn tại trước deploy.

Mục lục

Esc

Tìm theo tiêu đề và nội dung trong mọi chương.