--- name: ui-translation description: Translate natural language UI descriptions into IDS (Iress Design System) component implementations using `@iress-oss/ids-components` and `@iress-oss/ids-tokens`. --- # Skill: UI Translation ## Purpose Translate natural language UI descriptions into IDS (Iress Design System) component implementations using `@iress-oss/ids-components` and `@iress-oss/ids-tokens`. ## Setup ```tsx import '@iress-oss/ids-components/dist/style.css'; // Required — component styles import '@iress-oss/ids-tokens/build/css-vars.css'; // Required if using tokens directly import { IressProvider, IressButton, IressInput, IressField, IressStack, IressInline, IressText, IressCard, // ... import what you need } from '@iress-oss/ids-components'; // Wrap your app in IressProvider (handles fonts + CSS variables) function App() { return {/* your UI */}; } ``` ## Component Mapping ### Actions | Description | IDS Component | Example | | -------------------------------- | -------------------------------------- | ------------------------------------------------------------------ | | Submit / primary action button | `IressButton mode="primary"` | `Submit` | | Cancel / secondary action button | `IressButton mode="secondary"` | `Cancel` | | Less prominent action | `IressButton mode="tertiary"` | `Details` | | Icon-only action | `IressButton icon="edit" mode="muted"` | `Edit` | | Danger / delete action | `IressButton status="danger"` | `Delete` | | Link in text | `IressLink` | `About` | | Dropdown/context menu trigger | `IressDropdownMenu` | See patterns docs | ### Form Inputs | Description | IDS Component | Example | | ------------------------ | ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | | Labelled text input | `IressField` + `IressInput` | See Form example below | | Select dropdown | `IressField` + `IressSelect` | `...` | | Currency input | `IressField` + `IressInputCurrency` | `` | | Checkbox | `IressCheckbox` | `` | | Checkbox group | `IressCheckboxGroup` | `` | | Radio buttons | `IressRadioGroup` + `IressRadio` | `` | | Toggle switch | `IressToggle` | `` | | Slider / range | `IressSlider` | `` | | Autocomplete / typeahead | `IressAutocomplete` | See component docs | | Read-only display | `IressReadonly` | `` | ### Layout | Description | IDS Component | Example | | -------------------------------------------- | ----------------------- | ----------------------------------------------------------------------------------------- | | Vertical stack (items stacked top-to-bottom) | `IressStack` | `...` | | Horizontal row (items side-by-side) | `IressInline` | `...` | | Grid columns | `IressRow` + `IressCol` | `......` | | Container with max-width | `IressContainer` | `...` | | Divider / separator | `IressDivider` | `` | | Responsive visibility | `IressHide` | `Desktop only` | ### Content & Display | Description | IDS Component | Example | | -------------------- | --------------------------- | ----------------------------------------------------------------------------------------------------------- | | Text / paragraph | `IressText` | `Body text` | | Heading | `IressText element="h2"` | `Heading` | | Card / panel | `IressCard` or `IressPanel` | `TitleContent` | | Alert / notification | `IressAlert` | `Saved!` | | Loading spinner | `IressSpinner` | `` | | Skeleton loader | `IressSkeleton` | `` | | Progress bar | `IressProgress` | `` | | Image | `IressImage` | `` | | Icon | `IressIcon` | `` | | Tag / badge | `IressTag` | `New` | | Pill | `IressPill` | `Category` | | Tooltip | `IressTooltip` | `Hover me` | ### Overlays & Navigation | Description | IDS Component | Example | | ------------------------------------- | ----------------------------- | ------------------------------------------------------------------------- | | Modal / dialog | `IressModal` | See Modal docs | | Status modal (danger/success/warning) | `IressModal status="danger"` | Use `actions` prop for buttons; size restricted to `sm`/`md` | | Slideout / drawer | `IressSlideout` | See Slideout docs | | Popover | `IressPopover` | See Popover docs | | Menu | `IressMenu` + `IressMenuItem` | See Menu docs | | Tab navigation | `IressTabSet` + `IressTab` | `Content 1` | | Skip link (a11y) | `IressSkipLink` | `Skip to content` | | Side navigation | `IressSideNav` | See SideNav pattern docs | | Breadcrumbs | `IressBreadcrumbs` | See Breadcrumbs pattern docs | ### Tables | Description | IDS Component | Example | | ----------- | ------------- | ------------------------------------------------------------------------------------------------------- | | Data table | `IressTable` | `......` | ## Styling Props (IressCSSProps) Most IDS components accept styling props for layout adjustments: | Prop | Purpose | Values | | -------------- | ------------------------------- | ------------------------------------------------------------------------------------------------------------------------ | | `alignSelf` | Override flex alignment | `"start"`, `"end"`, `"center"`, `"stretch"` | | `bg` | Background colour | Colour tokens: `"colour.primary.fill"`, `"colour.neutral.20"`, `"alt"`, etc. | | `borderRadius` | Border radius | Radius tokens: `"radius.0"` – `"radius.4"`, `"none"` | | `color` | Text colour | Colour tokens: `"colour.neutral.80"`, `"colour.primary.text"`, etc. | | `flex` | Flex grow | `"1"` only | | `focusable` | Apply focus ring | `"true"`, `"within"` | | `hideFrom` | Hide from breakpoint up | `true`, or breakpoints: `"sm"`, `"md"`, `"lg"`, `"xl"` | | `hideBelow` | Hide below breakpoint | Breakpoints: `"sm"`, `"md"`, `"lg"`, `"xl"` | | `maxWidth` | Max width | Size tokens: `"container.sm"`, `"container.md"`, etc. | | `m` | Margin (all sides) | Spacing tokens: `"xs"` – `"xl"`, `"spacing.1"` – `"spacing.10"`, `"auto"`, negatives (responsive) | | `mx` | Margin horizontal | Same as `m` (responsive) | | `my` | Margin vertical | Same as `m` (responsive) | | `mt` | Margin top | Same as `m` (responsive) | | `mr` | Margin right | Same as `m` (responsive) | | `mb` | Margin bottom | Same as `m` (responsive) | | `ml` | Margin left | Same as `m` (responsive) | | `noGutter` | Remove last-child bottom margin | `true` / `false` | | `p` | Padding (all sides) | Spacing tokens: `"xs"` – `"xl"`, `"spacing.1"` – `"spacing.10"` (responsive) | | `px` | Padding horizontal | Same as `p` (responsive) | | `py` | Padding vertical | Same as `p` (responsive) | | `pt` | Padding top | Same as `p` (responsive) | | `pr` | Padding right | Same as `p` (responsive) | | `pb` | Padding bottom | Same as `p` (responsive) | | `pl` | Padding left | Same as `p` (responsive) | | `scrollable` | Enable overflow scrolling | `true`, `"x"`, `"y"` | | `srOnly` | Screen-reader only | `true` / `false` (responsive) | | `stretch` | Fill parent height | `true` / `false` | | `textAlign` | Text alignment | `"left"`, `"right"`, `"center"`, `"justify"`, `"inherit"` | | `textStyle` | Typography style | `"typography.body.sm"`, `"typography.body.md"`, `"typography.heading.1"` – `"typography.heading.5"`, `"typography.code"` | | `width` | Element width | Size tokens: `"input.2"` – `"input.16"`, `"3/12"` – `"12/12"` (grid), `"auto"` (responsive) | ## Translation Examples ### "A login form with email and password fields and a submit button" ```tsx import { IressButton, IressField, IressInput, IressStack, } from '@iress-oss/ids-components'; function LoginForm() { return ( Log in ); } ``` ### "A card with a title, description, and two action buttons" ```tsx import { IressCard, IressButton, IressInline, IressText, } from '@iress-oss/ids-components'; function ActionCard() { return ( Card Title This is the card description with supporting details. Confirm Cancel ); } ``` ### "A settings page with a toggle, some checkboxes, and a save button" ```tsx import { IressStack, IressToggle, IressCheckboxGroup, IressCheckbox, IressButton, IressText, IressDivider, } from '@iress-oss/ids-components'; function SettingsPage() { return ( Settings Save settings ); } ``` ## Best Practices 1. **Always wrap in IressProvider** — Required at the root of your app for fonts and CSS variables 2. **Use IressField for all form inputs** — Provides consistent labels, hints, and validation display 3. **Use IressStack/IressInline for layout** — Prefer these over custom CSS flex/grid 4. **Use spacing tokens for gap** — Values 0–10 map to multiples of 4px 5. **Use semantic button modes** — One `primary` per section, `secondary` for most actions 6. **Always include labels** — All form inputs need accessible labels via `IressField` 7. **Use status for feedback** — `IressAlert` for inline messages, `IressModal status="danger"` for confirmation dialogs, `status` prop on buttons for danger/success 8. **Prefer IDS components** — Use `IressText` instead of raw `

`, `IressButton` instead of `