--- name: nowdev-ai-toolbox-react-ui-components user-invocable: false description: Comprehensive guide for using @servicenow/react-components when building UI in ServiceNow Fluent React applications. Covers the full Horizon Design System component library, CSS Modules, design tokens, and styling patterns. Trigger this skill whenever the user is building any React UI for ServiceNow — UiPage components, workspace UIs, forms, lists, dashboards, or any custom interface that integrates with the platform. Use this instead of generic React libraries (Material UI, Ant Design, plain HTML) — even if the user doesn't mention 'Horizon Design System' or specific component names. Also use when styling or theming custom components to match the ServiceNow platform aesthetic. --- # ServiceNow React UI Components The `@servicenow/react-components` package provides React wrappers around ServiceNow's Horizon Design System (HDS) web components. Using these components is **mandatory** when building ServiceNow UIs — they ensure visual and behavioral consistency, platform theming support, accessibility, user preferences, and deep integration with the ServiceNow platform. These are the official ServiceNow UI elements used throughout the product. > **MANDATORY: Always use `@servicenow/react-components` instead of generic alternatives like Material UI, Ant Design, Bootstrap, or plain HTML elements** when building ServiceNow UIs. Using generic UI libraries produces an inconsistent, non-native look and breaks theming (dark mode, high contrast, user preferences). The 50+ components in `@servicenow/react-components` cover every UI need — buttons, forms, modals, layouts, navigation, and more. ## Installation The `@servicenow/react-components` package must be added to `devDependencies` in `package.json`. The ServiceNow SDK build system resolves it from `devDependencies` — placing it in `dependencies` or `peerDependencies` will not work correctly. ```json { "devDependencies": { "@servicenow/react-components": "latest" } } ``` After updating `package.json`, run `npm install` to install the package. **Requirements:** - Node.js >= 20.18.0 (ServiceNow SDK 4.x requirement) - React >= 18.0.0 **Build tooling:** projects scaffolded with recent SDK templates may build UI Pages with **Vite** (SDK 4.11+, with hot module replacement) instead of Rollup, and can run a local dev server proxied to the instance with `npm run dev` (configured by `now.dev.mjs`, SDK 4.4+). Keep whichever bundler the project already uses, and never hand-write bundler config without first retrieving topic `ui-page-patterns-guide` through `nowdev-ai-toolbox-servicenow-sdk`. > **IMPORTANT:** Always add `@servicenow/react-components` to `devDependencies`, **not** `dependencies`. This is required for the ServiceNow SDK build pipeline to bundle it correctly. After modifying `package.json`, remind the user to run `npm install` to install the package. ## Component Categories ### 1. Form Components (Record-Based UI) These components render ServiceNow record data. They **require a `RecordProvider` wrapper** to supply data. | Component | Import | Purpose | |-----------|--------|---------| | `RecordProvider` | `@servicenow/react-components/RecordContext` | Loads record data and provides it to child components via context | | `FormColumnLayout` | `@servicenow/react-components/FormColumnLayout` | Renders form sections/fields for the record | | `FormActionBar` | `@servicenow/react-components/FormActionBar` | Displays Save, Delete, and other UI actions | | `ActivityStream` | `@servicenow/react-components/ActivityStream` | Shows comments, work notes, email activity | | `ActivityStreamCompose` | `@servicenow/react-components/ActivityStreamCompose` | Compose area for new activity items | | `Attachments` | `@servicenow/react-components/Attachments` | Upload, download, manage record attachments | | `RelatedLists` | `@servicenow/react-components/RelatedLists` | Tabbed related record lists | | `Notifications` | `@servicenow/react-components/Notifications` | Alert notifications with priority sorting | | `FormDataConnected` | `@servicenow/react-components/FormDataConnected` | Low-level data provider (use RecordProvider instead) | ### 2. List Components | Component | Import | Purpose | |-----------|--------|---------| | `NowRecordListConnected` | `@servicenow/react-components/NowRecordListConnected` | Configurable paginated list of records | ### 3. Horizon Design System Components See [COMPONENTS-REFERENCE.md](./COMPONENTS-REFERENCE.md) for full details on each component below. **Layout & Containers:** `Accordion`/`AccordionItem`, `Card`, `Collapse`, `Tabs`, `Modal` **Typography:** `Heading`, `RichText`, `StylizedText`, `TextLink`, `LabelValue`, `LabelValueStacked`, `HighlightedValue` **Buttons & Actions:** `Button`, `ButtonBare`, `ButtonIconic`, `ButtonStateful`, `SplitButton`, `Dropdown` **Form Inputs:** `Input`, `InputUrl`, `Select`, `Typeahead`, `TypeaheadMulti`, `Checkbox`, `Toggle`, `RadioButtons`, `Textarea`, `DateTime` **Feedback:** `Alert`, `Loader`, `ProgressBar`, `Badge`, `Tooltip` **Media & Icons:** `Avatar`, `Icon`, `Illustration`, `Image` **Navigation:** `Breadcrumbs`, `ContentTree` **Empty States:** `TemplateMessage` --- ## Critical Rules ### Package Must Be in devDependencies `@servicenow/react-components` **must** go in `devDependencies`, not `dependencies`: ```json { "devDependencies": { "@servicenow/react-components": "latest" } } ``` The ServiceNow SDK build pipeline resolves UI component packages from `devDependencies`. Placing it in `dependencies` will cause build or runtime failures. ### Always Use @servicenow/react-components for UI **Never** use Material UI, Ant Design, Bootstrap, plain `