### Run Development and Production Tasks
Source: https://github.com/ssagroup/ui-kit/blob/main/CONTRIBUTING.md
Commands to serve or build specific dashboard examples within the monorepo.
```bash
# Run in development mode
pnpm --filter ./examples/fitness-dashboard serve
# Build for production
pnpm --filter ./examples/fitness-dashboard build
```
--------------------------------
### Install pNPM and Project Dependencies
Source: https://github.com/ssagroup/ui-kit/blob/main/CONTRIBUTING.md
Commands to install the pNPM package manager globally and set up the project environment by cloning the repository and installing workspace dependencies.
```bash
npm install -g pnpm
git clone git@github.com:ssagroup/ui-kit.git
pnpm install --frozen-lockfile
```
--------------------------------
### Build UI Kit Packages
Source: https://github.com/ssagroup/ui-kit/blob/main/CONTRIBUTING.md
Instructions for building packages in dependency order to ensure changes are correctly propagated. Includes commands for individual builds, full builds, and watch mode.
```bash
# Build packages in dependency order
pnpm build:utils
pnpm build:hooks
pnpm build:core
# Build all packages or specific ones
pnpm build:all
pnpm build:widgets
# Watch mode for automatic rebuilds
pnpm build:core:watch
```
--------------------------------
### Execute Scripts with pNPM
Source: https://github.com/ssagroup/ui-kit/blob/main/CONTRIBUTING.md
Demonstrates how to run scripts defined in package.json files, either for the root project or specific sub-packages using the --filter flag.
```bash
pnpm test
pnpm --filter ./packages/core build
```
--------------------------------
### Install @ssa-ui-kit/infra-dash
Source: https://github.com/ssagroup/ui-kit/blob/main/packages/infra-dash/docs/index.mdx
Instructions for installing the @ssa-ui-kit/infra-dash library using npm, yarn, or pnpm. Ensure @ssa-ui-kit/core is installed as a peer dependency.
```bash
npm install @ssa-ui-kit/infra-dash
# or
yarn add @ssa-ui-kit/infra-dash
# or
pnpm add @ssa-ui-kit/infra-dash
```
--------------------------------
### Build Monorepo Projects
Source: https://github.com/ssagroup/ui-kit/blob/main/CONTRIBUTING.md
Commands to compile all sub-projects within the monorepo workspace to ensure local development readiness.
```bash
pnpm build:all
```
--------------------------------
### Execute Release Scripts
Source: https://github.com/ssagroup/ui-kit/blob/main/CONTRIBUTING.md
Commands to trigger the release process with specific version increments, tags, and dry-run capabilities.
```bash
# Perform a patch release
pnpm release --increment patch
# Perform a minor release
pnpm release --increment minor
# Dry run release to verify output
pnpm release --increment patch --dry-run
```
--------------------------------
### Install SSA UI Kit Dependencies
Source: https://github.com/ssagroup/ui-kit/blob/main/README.md
Commands to install the core library and optional hooks package using npm, yarn, or pnpm, along with required peer dependencies.
```bash
# Core components
npm install @ssa-ui-kit/core
# or
yarn add @ssa-ui-kit/core
# or
pnpm add @ssa-ui-kit/core
# Hooks (optional, separate package)
npm install @ssa-ui-kit/hooks
# or
yarn add @ssa-ui-kit/hooks
# or
pnpm add @ssa-ui-kit/hooks
# Peer Dependencies
npm install react@19.x react-dom@19.x @emotion/react @emotion/styled react-hook-form
```
--------------------------------
### Manage Node.js Version with NVM
Source: https://github.com/ssagroup/ui-kit/blob/main/CONTRIBUTING.md
Uses the NVM tool to automatically switch to the Node.js version specified in the project's .nvmrc file.
```bash
nvm use
```
--------------------------------
### Pagination: Navigation and Row Selector Examples (React)
Source: https://context7.com/ssagroup/ui-kit/llms.txt
Demonstrates the Pagination component for navigating through pages. It includes examples of basic pagination, enabling page settings and rows-per-page selection, and handling disabled states. Requires a context provider for state management.
```tsx
import { Pagination, PaginationContextProvider } from '@ssa-ui-kit/core';
// Basic pagination
// Pagination with page setting and rows per page
// First page selected
// Disabled pagination
```
--------------------------------
### Install SSA UI Kit Packages
Source: https://context7.com/ssagroup/ui-kit/llms.txt
Installs the core, hooks, and utility packages for the SSA UI Kit using npm or pnpm. These packages provide essential components and functionalities for your project.
```bash
npm install @ssa-ui-kit/core @ssa-ui-kit/hooks @ssa-ui-kit/utils
# or
pnpm add @ssa-ui-kit/core @ssa-ui-kit/hooks @ssa-ui-kit/utils
```
--------------------------------
### Implementing a Complete Form
Source: https://github.com/ssagroup/ui-kit/blob/main/packages/core/src/components/Form/Form.mdx
A comprehensive example showing the usage of Form, FormGroup, and TextField components, including validation schemas and textarea configuration.
```javascript
type Inputs = {
name: string;
lastname: string;
address: string;
};
const Sample = () => {
const { register, handleSubmit, formState: { errors } } = useForm();
const onSubmit: SubmitHandler = (data) => console.log(data);
return (
);
}
```
--------------------------------
### Implement Default Pagination with Context
Source: https://github.com/ssagroup/ui-kit/blob/main/packages/core/src/components/Pagination/Pagination.mdx
Demonstrates the basic setup for the Pagination component. It requires the PaginationContextProvider to manage the current page state.
```tsx
import { Pagination, PaginationContextProvider } from '@ssa-ui-kit/core';
const App = () => {
return (
);
};
```
--------------------------------
### Manage pNPM Workspace Dependencies
Source: https://github.com/ssagroup/ui-kit/blob/main/CONTRIBUTING.md
Commands for adding or removing dependencies at the workspace root or within specific sub-projects using the --filter flag.
```bash
# Adds a package to the pNPM workspace root
pnpm add @emotion/react -w
# Removes a package from the pNPM workspace root
pnpm remove @emotion/react -w
# Adds a dev dependency to the workspace root
pnpm add webpack -w -D
# Adds a dev package to a specific sub-project
pnpm add @storybook/react --filter ./packages/core -D
```
--------------------------------
### Implement Basic Popover with React
Source: https://github.com/ssagroup/ui-kit/blob/main/packages/core/src/components/Popover/stories/Popover.mdx
Demonstrates the standard implementation of the Popover component using its compound sub-components. This setup includes a trigger, heading, description, and close action.
```tsx
import {
Popover,
PopoverTrigger,
PopoverContent,
PopoverHeading,
PopoverDescription,
PopoverClose,
} from '@ssa-ui-kit/core';
function BasicPopover() {
return (
Open PopoverPopover Title
This is the popover content. You can include any React components
here.
Close
);
}
```
--------------------------------
### Implement UI Kit Components
Source: https://github.com/ssagroup/ui-kit/blob/main/README.md
Examples for rendering Buttons, Inputs with React Hook Form, and Tables using the @ssa-ui-kit/core library.
```tsx
import { Button, Icon, Input, Table, TableHead, TableBody, TableRow, TableCell, TableCellHeader } from '@ssa-ui-kit/core';
import { useForm, FormProvider } from 'react-hook-form';
// Button Example
} variant="secondary" />
// Input Example
function MyForm() {
const methods = useForm();
return (
);
}
// Table Example
function UserTable() {
const data = [{ id: 1, name: 'John Doe' }];
return (
Name{data.map(u => {u.name})}
);
}
```
--------------------------------
### Configure Hover Tooltip Placements
Source: https://github.com/ssagroup/ui-kit/blob/main/packages/core/src/components/Tooltip/Tooltip.mdx
Shows how to use the 'placement' prop to position tooltips on different sides of the trigger element. This example utilizes the 'enableHover' prop for interaction.
```tsx
function HoverTooltips() {
return (
Tooltip appears on topTooltip appears at the bottomTooltip appears on the leftTooltip appears on the right
);
}
```
--------------------------------
### SSA UI Kit Input Component Examples with React Hook Form
Source: https://context7.com/ssagroup/ui-kit/llms.txt
Illustrates the usage of the Input component from SSA UI Kit, integrated with react-hook-form. Examples include basic input, validation, status states (error, success), helper text, and disabled states.
```tsx
import { Input, Icon } from '@ssa-ui-kit/core';
import { useForm, FieldValues } from 'react-hook-form';
function FormExample() {
const { register } = useForm();
return (
<>
{/* Basic input with validation */}
{/* Input with end icon */}
}
/>
{/* Password input with toggle visibility */}
}
/>
{/* Input with error state and helper text */}
{/* Success state input */}
{/* Disabled input */}
>
);
}
```
--------------------------------
### Quick Start with InfraDashProvider and DashboardViewer
Source: https://github.com/ssagroup/ui-kit/blob/main/packages/infra-dash/docs/index.mdx
Demonstrates how to set up the InfraDashProvider with a RestInfraDashTransport instance and render a DashboardViewer component. Includes configuration for base URL and authentication.
```tsx
import React from 'react';
import {
InfraDashProvider,
DashboardViewer,
RestInfraDashTransport
} from '@ssa-ui-kit/infra-dash';
// Create a transport instance to handle data fetching
const transport = new RestInfraDashTransport({
// Base InfraDash URL
baseUrl: '/api/InfraDash',
authMiddleware: (request) => {
request.headers.set(
'Authorization',
'Bearer your-auth-token-here',
);
return request;
},
unwrapResponse: (response) => {
// Unwrap the response data if needed
...
},
});
function App() {
return (
);
}
```
--------------------------------
### Implement Basic FiltersMultiSelect Component
Source: https://github.com/ssagroup/ui-kit/blob/main/packages/core/src/components/FiltersMultiSelect/FiltersMultiSelect.mdx
Demonstrates the basic setup of the FiltersMultiSelect component using the useFilterMultiSelect hook. It shows how to initialize the store with default selected filters and render the component with searchable options.
```tsx
import {
FiltersMultiSelect,
FiltersMultiSelectOptions,
FiltersMultiSelectOption,
useFilterMultiSelect,
Filter,
} from '@ssa-ui-kit/core';
function BasicFiltersExample() {
const filters: Filter[] = [
{ id: '1', label: 'Active Users' },
{ id: '2', label: 'Premium Accounts' },
{ id: '3', label: 'Recent Signups' },
{ id: '4', label: 'Marketing Segment', group: true },
{ id: '5', label: 'Mobile Users' },
{ id: '6', label: 'High Value Customers' },
];
const store = useFilterMultiSelect({
defaultSelectedFilters: [
{ id: '1', label: 'Active Users', type: 'include' },
{ id: '2', label: 'Premium Accounts', type: 'exclude' },
],
onChange: (selectedFilters) => {
console.log('Filters changed:', selectedFilters);
},
});
const filtersToShow = filters.filter((filter) =>
filter.label.toLowerCase().includes(store.search.toLowerCase()),
);
return (
{filtersToShow.map((filter) => (
{filter.label}
))}
);
}
```
--------------------------------
### AccordionGroup: Basic and Multiple Open Panels Example (React)
Source: https://context7.com/ssagroup/ui-kit/llms.txt
Demonstrates how to use the AccordionGroup component to create collapsible content panels. It requires a context provider and supports single or multiple open panels. The example shows basic usage with different sizes and content.
```tsx
import {
AccordionGroup,
Accordion,
AccordionTitle,
AccordionContent,
AccordionGroupContextProvider,
Typography,
} from '@ssa-ui-kit/core';
// Basic accordion group (requires context provider)
(
Welcome to SSA UI Kit! This section covers installation and basic setup.
)}
renderTitle={AccordionTitle}
/>
(
Explore our comprehensive component library including buttons, inputs, and more.
)}
renderTitle={AccordionTitle}
/>
(
Learn about theming, customization, and advanced patterns.
)}
renderTitle={AccordionTitle}
/>
// Single accordion open at a time
{/* Accordion items... */}
```
--------------------------------
### Default ButtonGroup Usage Example
Source: https://github.com/ssagroup/ui-kit/blob/main/packages/core/src/components/ButtonGroup/ButtonGroup.mdx
Demonstrates the basic implementation of the ButtonGroup component, including defining items and handling click events. It requires the ButtonGroup and ButtonGroupItem types from '@ssa-ui-kit/core'.
```tsx
import { ButtonGroup, ButtonGroupItem } from '@ssa-ui-kit/core';
const items: ButtonGroupItem[] = [
{ id: 1, text: 'All (10)', isDisabled: false },
{ id: 2, text: 'Running (117)', isDisabled: false },
{ id: 3, text: 'Stopped (2)', isDisabled: false },
];
function Demo() {
const handleClick = (item: ButtonGroupItem) => {
console.log('Selected:', item);
};
return ;
}
```
--------------------------------
### CollapsibleNavBar: Responsive Design Example (React)
Source: https://github.com/ssagroup/ui-kit/blob/main/packages/core/src/components/CollapsibleNavBar/stories/CollapsibleNavBar.mdx
Illustrates how CollapsibleNavBar automatically adapts to different screen sizes, functioning as a sidebar on larger screens and a hamburger menu on smaller ones. Includes a simple app logo.
```tsx
function ResponsiveNavigation() {
const items = [
{ path: '', iconName: 'home', iconSize: 20, title: 'Dashboard' },
{ path: 'projects', iconName: 'folder', iconSize: 20, title: 'Projects' },
{ path: 'team', iconName: 'user', iconSize: 20, title: 'Team' },
{ path: 'calendar', iconName: 'calendar', iconSize: 20, title: 'Calendar' },
];
const AppLogo = () => (
APP
);
return (
}
onChange={(isExpanded) => {
console.log('Sidebar expanded:', isExpanded);
// Handle navigation state changes
}}
/>
);
}
```
--------------------------------
### Basic DatePicker Usage
Source: https://github.com/ssagroup/ui-kit/blob/main/packages/core/src/components/DatePicker/DatePicker.mdx
Demonstrates the default usage of the DatePicker component, including its name, label, helper text, and change event handler. This is the foundational example for integrating the DatePicker into an application.
```tsx
import { DatePicker } from '@ssa-ui-kit/core';
function BasicDatePicker() {
const handleDateChange = (date?: Date) => {
console.log('Selected date:', date);
};
return (
);
}
```
--------------------------------
### Apply Button Variants and Sizes
Source: https://github.com/ssagroup/ui-kit/blob/main/packages/core/src/components/Button/Button.mdx
Examples of various button variants (Primary, Secondary, Tertiary, Error, Warning, Success) and sizes (Small, Medium, Large) for different UI contexts.
```tsx
```
--------------------------------
### Setup SSA UI Kit Theme Provider
Source: https://context7.com/ssagroup/ui-kit/llms.txt
Sets up the Emotion ThemeProvider with the main theme from SSA UI Kit. This is essential for applying consistent styling, colors, and breakpoints across your application's components.
```tsx
import { ThemeProvider } from '@emotion/react';
import { mainTheme } from '@ssa-ui-kit/core';
function App() {
return (
);
}
```
--------------------------------
### Input Component with Start and End Elements
Source: https://github.com/ssagroup/ui-kit/blob/main/packages/core/src/components/Input/Input.mdx
Demonstrates how to augment the Input component with leading ('startElement') and trailing ('endElement') elements, such as icons or custom buttons. This enhances usability and provides visual cues.
```tsx
// Input with end icon
}
/>
// Input with start icon
}
/>
// Input with both icons
}
endElement={}
/>
// Input with custom action button
console.log('Resend code')}>
Resend
}
/>
```
--------------------------------
### CollapsibleNavBar: Default Usage Example (React)
Source: https://github.com/ssagroup/ui-kit/blob/main/packages/core/src/components/CollapsibleNavBar/stories/CollapsibleNavBar.mdx
Demonstrates the basic implementation of the CollapsibleNavBar component with a list of navigation items and a custom logo. It utilizes react-router-dom for routing and logs navigation toggle events.
```tsx
import { CollapsibleNavBar } from '@ssa-ui-kit/core';
import { MemoryRouter } from 'react-router-dom';
function BasicNavigation() {
const navigationItems = [
{ path: '', iconName: 'home', iconSize: 20, title: 'Dashboard' },
{ path: 'users', iconName: 'user', iconSize: 20, title: 'Users' },
{ path: 'settings', iconName: 'settings', iconSize: 20, title: 'Settings' },
{
prefix: 'reports/',
iconName: 'chart',
iconSize: 22,
title: 'Reports',
items: [
{ path: 'analytics', title: 'Analytics' },
{ path: 'sales', title: 'Sales' },
{ path: 'performance', title: 'Performance' },
],
},
{
path: 'notifications',
iconName: 'notification',
iconSize: 24,
title: 'Notifications',
},
];
const Logo = () => (
);
return (
}
onChange={(isOpen) => console.log('Navigation toggled:', isOpen)}
/>
);
}
```
--------------------------------
### Display Color Themes for Progress Bars (React)
Source: https://github.com/ssagroup/ui-kit/blob/main/packages/core/src/components/Progress/Progress.mdx
Demonstrates how to use different color themes for progress bars by mapping an array of color objects. Each object specifies a color name and a percentage. This example utilizes React and JSX.
```tsx
function ColorThemeExamples() {
const colors = [
{ name: 'blue', percentage: 90 },
{ name: 'green', percentage: 75 },
{ name: 'yellow', percentage: 60 },
{ name: 'pink', percentage: 45 },
{ name: 'purple', percentage: 30 },
{ name: 'turquoise', percentage: 85 },
{ name: 'blueLight', percentage: 55 },
];
return (
{colors.map((color) => (
{color.name}{color.percentage}%
))}
);
}
```
--------------------------------
### Implement SSA UI Kit Components in React
Source: https://github.com/ssagroup/ui-kit/blob/main/README.md
A complete example demonstrating the integration of Card, Input, Table, and Button components within a React application using React Hook Form and Emotion ThemeProvider.
```tsx
import { ThemeProvider } from '@emotion/react';
import { FormProvider, useForm } from 'react-hook-form';
import { Card, CardHeader, CardContent, Button, Input, Typography, Table, TableHead, TableBody, TableRow, TableCell, TableCellHeader, mainTheme, Theme as T } from '@ssa-ui-kit/core';
declare module '@emotion/react' {
export interface Theme extends T {}
}
function App() {
const methods = useForm();
const users = [
{ id: 1, name: 'John Doe', email: 'john@example.com' },
{ id: 2, name: 'Jane Smith', email: 'jane@example.com' },
];
return (
User Management
);
}
```
--------------------------------
### Initialize Theme Provider
Source: https://github.com/ssagroup/ui-kit/blob/main/README.md
Wraps the application with Emotion's ThemeProvider and augments TypeScript types to support the UI kit's mainTheme.
```tsx
import { ThemeProvider } from '@emotion/react';
import { mainTheme, Theme as T } from '@ssa-ui-kit/core';
declare module '@emotion/react' {
export interface Theme extends T {}
}
function App() {
return (
{/* Your app components */}
);
}
```
--------------------------------
### Customize Dropdown Placeholder Text
Source: https://github.com/ssagroup/ui-kit/blob/main/packages/core/src/components/Dropdown/Dropdown.mdx
Sets custom placeholder text for the Dropdown component when no item is selected. This is achieved by passing a `placeholder` prop to the `Dropdown` component. The example demonstrates how to provide a default message to guide user selection.
```tsx
{items.map((item) => (
{item.value}
))}
```
--------------------------------
### Implement Basic Drawer with Hook API
Source: https://github.com/ssagroup/ui-kit/blob/main/packages/core/src/components/Drawer/Drawer.mdx
Demonstrates the standard implementation of a Drawer using the useDrawer hook and component composition. It shows how to trigger the drawer state and structure the content within the Root, Portal, and Overlay components.
```tsx
import { Drawer, useDrawer, Button } from '@ssa-ui-kit/core';
function BasicDrawer() {
const drawer = useDrawer({
title: 'Settings',
withCloseButton: true,
});
return (
<>
Drawer Content
This is the drawer content area where you can place any
components.
>
);
}
```
--------------------------------
### CollapsibleNavBar: Nested Navigation Example (React)
Source: https://github.com/ssagroup/ui-kit/blob/main/packages/core/src/components/CollapsibleNavBar/stories/CollapsibleNavBar.mdx
Shows how to implement hierarchical navigation structures with expandable submenus within the CollapsibleNavBar. This example includes multiple levels of nested items and customizes the submenu width.
```tsx
function NestedNavigation() {
const items = [
{ path: '', iconName: 'home', iconSize: 20, title: 'Dashboard' },
{
prefix: 'ecommerce/',
iconName: 'shopping-cart',
iconSize: 22,
title: 'E-commerce',
items: [
{ path: 'products', title: 'Products' },
{ path: 'orders', title: 'Orders' },
{ path: 'customers', title: 'Customers' },
{ path: 'inventory', title: 'Inventory' },
{ path: 'analytics', title: 'Analytics' },
],
},
{
prefix: 'content/',
iconName: 'document',
iconSize: 20,
title: 'Content Management',
items: [
{ path: 'posts', title: 'Blog Posts' },
{ path: 'pages', title: 'Static Pages' },
{ path: 'media', title: 'Media Library' },
{ path: 'categories', title: 'Categories' },
],
},
{
prefix: 'admin/',
iconName: 'settings',
iconSize: 20,
title: 'Administration',
items: [
{ path: 'users', title: 'User Management' },
{ path: 'roles', title: 'Roles & Permissions' },
{ path: 'system', title: 'System Settings' },
{ path: 'logs', title: 'Activity Logs' },
],
},
];
return (
📱 CMS}
subMenuMaxWidth={220}
onChange={(isOpen) => console.log('Navigation state:', isOpen)}
/>
);
}
```
--------------------------------
### Toggle Portal vs Container Rendering
Source: https://github.com/ssagroup/ui-kit/blob/main/packages/core/src/components/Drawer/Drawer.mdx
Illustrates the difference between rendering a drawer as a global overlay via Portal or inline within a specific container.
```tsx
// Portal rendering (overlay mode)
Content overlays the page
// Container rendering (inline mode)
Content pushes other content
```
--------------------------------
### Display Content in Indicator
Source: https://github.com/ssagroup/ui-kit/blob/main/packages/core/src/components/Indicator/Indicator.mdx
Examples of rendering text, numeric values, or custom JSX elements within the indicator badge.
```tsx
// Simple text
// Numeric content
// JSX Element content
+2100}>
```
--------------------------------
### Basic Dashboard Display with DashboardViewer
Source: https://github.com/ssagroup/ui-kit/blob/main/packages/infra-dash/docs/index.mdx
A simple example of how to use the DashboardViewer component to display a specific dashboard by its ID.
```tsx
import { DashboardViewer } from '@ssa-ui-kit/infra-dash';
function MyDashboard() {
return ;
}
```
--------------------------------
### Integrate Radio in forms
Source: https://github.com/ssagroup/ui-kit/blob/main/packages/core/src/components/Radio/Radio.mdx
Provides an example of using Radio buttons within a standard HTML form structure with fieldset and legend for accessibility.
```tsx
```
--------------------------------
### Modal Component Examples - React
Source: https://context7.com/ssagroup/ui-kit/llms.txt
Demonstrates the usage of the Modal component for displaying dialogs. It covers basic, custom content, and controlled modal patterns using React and @ssa-ui-kit/core. Dependencies include React hooks and various UI primitives from the kit.
```tsx
import {
Modal,
ModalContent,
ModalOpenButton,
ModalDismissButton,
Button,
Typography,
Icon,
} from '@ssa-ui-kit/core';
import { useState } from 'react';
// Basic modal with trigger button
}
/>
This is the modal content. Click the X to close.
// Modal with custom content and no background
Hello
This modal has no default background styling.
// Controlled modal with external state
function ControlledModal() {
const [isOpen, setIsOpen] = useState(false);
return (
<>