### Installation and Basic Setup Source: https://context7.com/umami-software/react-zen/llms.txt Install the React Zen library and import global styles. Create a basic app structure with ZenProvider for theming and essential components like Box, Heading, Text, and Button. ```bash npm install @umami/react-zen ``` ```tsx // Import the global styles once at your app root import '@umami/react-zen/styles.css'; import { ZenProvider, Button, Heading, Text, Box } from '@umami/react-zen'; function App() { return ( Welcome to React Zen Modern, minimalist components ); } export default App; ``` -------------------------------- ### Install React Zen library via npm Source: https://github.com/umami-software/react-zen/blob/master/README.md Installs the @umami/react-zen package using npm. This command adds the library to your project's dependencies, enabling you to import its components and styles. Requires npm installed and internet access. ```shell npm install @umami/react-zen ``` -------------------------------- ### React Zen TextField Component Examples Source: https://context7.com/umami-software/react-zen/llms.txt Demonstrates the usage of the TextField component from '@umami/react-zen', showcasing different variants like basic input, password, textarea, read-only with copy, and disabled states. It also includes an example of a controlled input with email validation. ```tsx import { TextField, Flexbox, Box, Text } from '@umami/react-zen'; import { useState } from 'react'; function TextFieldExamples() { const [value, setValue] = useState(''); return ( {/* Basic text field */} {/* Password field */} {/* Textarea mode */} {/* Read-only with copy */} {/* Disabled state */} ); } // Controlled input with validation function ControlledTextField() { const [email, setEmail] = useState(''); const [error, setError] = useState(''); const validateEmail = (value) => { const regex = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i; if (!regex.test(value)) { setError('Invalid email address'); } else { setError(''); } setEmail(value); }; return ( {error && {error}} ); } ``` -------------------------------- ### React Example: Border Widths Source: https://github.com/umami-software/react-zen/blob/master/src/content/docs/design/borders.mdx Illustrates setting the border width for an ExampleBox component. Accepts numeric values '1' through '4' to control the thickness of the border. ```jsx ``` -------------------------------- ### React Example: Border Positions Source: https://github.com/umami-software/react-zen/blob/master/src/content/docs/design/borders.mdx Demonstrates how to set the border position on an ExampleBox component. Supports default (all sides) or specific sides like 'top', 'right', 'bottom', and 'left'. ```jsx ``` -------------------------------- ### React Example: Border Colors Source: https://github.com/umami-software/react-zen/blob/master/src/content/docs/design/borders.mdx Demonstrates applying custom border colors to an ExampleBox component. Supports predefined color names like 'primary', 'red', 'blue', and 'green'. ```jsx ``` -------------------------------- ### React Zen Select and ComboBox Components Examples Source: https://context7.com/umami-software/react-zen/llms.txt Illustrates the use of Select and ComboBox components from '@umami/react-zen' for dropdown selections. The Select component is shown for single selection with a list of countries, and the ComboBox demonstrates searchable input with a list of frameworks. ```tsx import { Select, SelectItem, ComboBox, ComboBoxItem, Flexbox, Text } from '@umami/react-zen'; import { useState } from 'react'; function SelectExample() { const [selected, setSelected] = useState(''); const countries = [ { id: 'us', name: 'United States' }, { id: 'uk', name: 'United Kingdom' }, { id: 'ca', name: 'Canada' }, { id: 'au', name: 'Australia' }, { id: 'de', name: 'Germany' } ]; return ( {/* Basic select */} {/* Selected value display */} {selected && ( Selected: {countries.find(c => c.id === selected)?.name} )} ); } // Searchable ComboBox function ComboBoxExample() { const [value, setValue] = useState(''); const frameworks = [ { id: 'react', name: 'React' }, { id: 'vue', name: 'Vue.js' }, { id: 'angular', name: 'Angular' }, { id: 'svelte', name: 'Svelte' }, { id: 'next', name: 'Next.js' }, { id: 'nuxt', name: 'Nuxt.js' } ]; return ( {frameworks .filter(f => f.name.toLowerCase().includes(value.toLowerCase()) ) .map(framework => ( {framework.name} )) } ); } ``` -------------------------------- ### React Example: Border Radii Source: https://github.com/umami-software/react-zen/blob/master/src/content/docs/design/borders.mdx Shows how to apply different border radius values to an ExampleBox component. Supports predefined radii '1' through '4', and a 'full' option for fully rounded corners. ```jsx ``` -------------------------------- ### React Tooltip Example Source: https://github.com/umami-software/react-zen/blob/master/src/content/docs/components/tooltip.mdx This snippet demonstrates the usage of a React tooltip component. It showcases different placement options (top, left, right, bottom) and the ability to display an arrow. The `TooltipTrigger` and `Tooltip` components are used for triggering and displaying the tooltip content respectively. ```jsx Hello ``` ```jsx {`Hello`} {`Hello`} {`Hello`} {`Hello`} ``` ```jsx {`Hello`} {`Hello`} {`Hello`} {`Hello`} ``` ```jsx ``` -------------------------------- ### UI Layout Composition Using Zen Components in JSX Source: https://github.com/umami-software/react-zen/blob/master/src/content/docs/index.mdx This snippet demonstrates composing a welcome card layout using Zen's Box, Flexbox, Heading, Text, and Button components. It relies on React and Zen library installations, with props for styling like padding, alignment, and variants. Outputs a centered, shadowed container with text and interactive button; limitations include dependency on Zen's design system for full styling. ```jsx Welcome This is the zen way. ``` -------------------------------- ### React Modal Examples with Various Placements Source: https://github.com/umami-software/react-zen/blob/master/src/content/docs/components/modal.mdx Demonstrates the usage of the Modal component in React, showcasing different placement options (center, top, left, right, bottom, fullscreen) for overlay dialogs. It utilizes DialogTrigger and Button components for interaction. ```jsx Hello. Hello. Hello. Hello. Hello. Hello. ``` -------------------------------- ### Image component basic usage Source: https://github.com/umami-software/react-zen/blob/master/src/content/docs/components/image.mdx Demonstrates basic usage of the Image component with a maxWidth container. The component is imported from the 'react-zen' package and renders an image from a local path with alt text. This example is framework-agnostic beyond React, relies on the image file existing at the given src, and omits explicit width/height or lazy-loading controls. ```JSX Image ``` -------------------------------- ### Import and render Button component from React Zen Source: https://github.com/umami-software/react-zen/blob/master/README.md Shows how to import the Button component from the React Zen library and render it within a React functional component. The example demonstrates a minimal usage scenario without extra props. Ensure the stylesheet is imported for proper styling. ```javascript import { Button } from '@umami/react-zen'; export default function () { return ; } ``` -------------------------------- ### Display DataTable component with prop definitions in JSX Source: https://github.com/umami-software/react-zen/blob/master/src/content/docs/layout/box.mdx Provides an example of the DataTable component populated with a list of prop definitions and nested DataColumn components. Demonstrates passing complex data arrays and rendering table columns. Useful for documenting component APIs. ```jsx ' }, { name: 'position', value: 'Responsive<"static" | "relative" | "absolute" | "fixed" | "sticky">' }, { name: 'backgroundColor', value: 'BackgroundColor' }, { name: 'borderColor', value: 'BorderColor' }, { name: 'borderSize', value: 'Responsive<"1" | "2" | "3" | "4">' }, { name: 'borderTop', value: 'Responsive<"1" | "2" | "3" | "4">' }, { name: 'borderRight', value: 'Responsive<"1" | "2" | "3" | "4">' }, { name: 'borderBottom', value: 'Responsive<"1" | "2" | "3" | "4">' }, { name: 'borderLeft', value: 'Responsive<"1" | "2" | "3" | "4">' }, { name: 'borderRadius', value: 'Responsive<"1" | "2" | "3" | "4" | "5" | "6">' }, { name: 'hoverColor', value: 'HoverColor' }, { name: 'hoverBackgroundColor', value: 'HoverColor' }, { name: 'hoverBorderColor', value: 'HoverColor' }, { name: 'padding', value: 'Responsive' }, { name: 'paddingX', value: 'Responsive' }, { name: 'paddingY', value: 'Responsive' }, { name: 'paddingTop', value: 'Responsive' }, { name: 'paddingRight', value: 'Responsive' }, { name: 'paddingBottom', value: 'Responsive' }, { name: 'paddingLeft', value: 'Responsive' }, { name: 'margin', value: 'Responsive' }, { name: 'marginX', value: 'Responsive' }, { name: 'marginY', value: 'Responsive' }, { name: 'marginTop', value: 'Responsive' }, { name: 'marginRight', value: 'Responsive' }, { name: 'marginBottom', value: 'Responsive' }, { name: 'marginLeft', value: 'Responsive' }, { name: 'width', value: 'Responsive' }, { name: 'minWidth', value: 'Responsive' }, { name: 'maxWidth', value: 'Responsive' }, { name: 'height', value: 'Responsive' }, { name: 'minHeight', value: 'Responsive' }, { name: 'maxHeight', value: 'Responsive' }, { name: 'flexBasis', value: 'Responsive' }, { name: 'flexGrow', value: 'Responsive' }, { name: 'flexShrink', value: 'Responsive' }, { name: 'gridRow', value: 'Responsive' }, { name: 'gridColumn', value: 'Responsive' }, { name: 'order', value: 'Responsive' }, { name: 'as', value: 'string' }, { name: 'asChild', value: 'boolean' }, ]} > ``` -------------------------------- ### Basic Toggle Group Example (React) Source: https://github.com/umami-software/react-zen/blob/master/src/content/docs/components/toggle-group.mdx Demonstrates a basic React Toggle Group with single selection mode. It requires the ToggleGroup and ToggleGroupItem components. This component allows users to select a single option from a group of buttons. ```jsx One Two Three ``` -------------------------------- ### Flexbox Layout Example (React) Source: https://github.com/umami-software/react-zen/blob/master/src/content/docs/layout/flexbox.mdx Demonstrates the usage of the Flexbox component to create row and column layouts with customizable gap. It showcases the flexibility of Flexbox for arranging child elements. ```jsx ``` -------------------------------- ### React Button with onClick Handler Source: https://context7.com/umami-software/react-zen/llms.txt Shows how to implement an interactive Button component with an associated click handler. The 'onPress' prop is used to define the function executed when the button is clicked. This example requires '@umami/react-zen'. ```tsx import { Button } from '@umami/react-zen'; function InteractiveButton() { const handleClick = () => { console.log('Button clicked!'); // Perform action }; return ( ); } ``` -------------------------------- ### React Alert Banner Example Source: https://github.com/umami-software/react-zen/blob/master/src/content/docs/components/alert-banner.mdx Demonstrates the use of the AlertBanner component in React, including variations for error and info alerts. It utilizes React components for the alert banner and associated buttons. ```jsx } > ``` -------------------------------- ### Text Field with Placeholder - React Source: https://github.com/umami-software/react-zen/blob/master/src/content/docs/components/text-field.mdx Configures the text field to display placeholder text. The placeholder guides the user on the expected input without being part of the actual value. ```jsx import { TextField } from "@umami-software/react-zen"; function App() { return ; } ``` -------------------------------- ### Image object fit modes Source: https://github.com/umami-software/react-zen/blob/master/src/content/docs/components/image.mdx Shows how objectFit controls the image scaling within a fixed-height container. The same image is rendered with cover, fill, contain, scale-down, and none, each illustrating how the image is cropped or sized to fit the container. Uses Box/Column/Label to arrange examples vertically. Ensure sufficient container height and overflow settings to visualize differences; aspect ratio of the source image affects the visual result. ```JSX Image Image Image Image Image ``` -------------------------------- ### React Navbar Component Implementation Source: https://github.com/umami-software/react-zen/blob/master/src/content/docs/components/navbar.mdx Demonstrates how to structure a navigation bar using the Navbar component with nested dropdown menus. The example shows three main navigation sections (Product, Resources, Company) each containing sub-menu items, plus an external GitHub link. The component supports hierarchical menu structures and external URL navigation. ```jsx Features Pricing Documentation API Reference Support About Blog Careers GitHub ``` -------------------------------- ### Theme Management Hook and Components in React TSX Source: https://context7.com/umami-software/react-zen/llms.txt This implements theme state management using a Zustand hook with localStorage persistence and system preference detection, including toggle button, radio selector, and provider setup. Dependencies: @umami/react-zen (useTheme, ZenProvider, Button, Flexbox, Text). Inputs: Theme state ('light'|'dark') and color scheme ('system'); outputs: Updated theme application across app. Limitations: Assumes Zustand integration in hook; radio inputs use native HTML without library styling. ```tsx import { useTheme } from '@umami/react-zen'; import { Button, Flexbox, Text } from '@umami/react-zen'; function ThemeToggleButton() { const { theme, setTheme } = useTheme(); const toggleTheme = () => { setTheme(theme === 'light' ? 'dark' : 'light'); }; return ( ); } // Theme selector with radio buttons function ThemeSelector() { const { theme, setTheme } = useTheme(); return ( Theme Settings ); } // Initialize theme in app root import { ZenProvider, useInitTheme } from '@umami/react-zen'; function App() { return ( ); } ``` -------------------------------- ### React Form Submission with Validation Source: https://context7.com/umami-software/react-zen/llms.txt This snippet demonstrates how to submit a form with validation using React Hook Form. It includes example validation rules for required fields, minimum length, and pattern matching. It showcases making an API call after successful submission. ```tsx import { Form, FormField, FormSubmitButton, FormResetButton, TextField, Flexbox } from '@umami/react-zen'; function LoginForm() { const handleSubmit = (values) => { console.log('Form submitted:', values); // { username: 'john', password: 'secret123' } // Make API call fetch('/api/login', { method: 'POST', body: JSON.stringify(values), headers: { 'Content-Type': 'application/json' } }) .then(res => res.json()) .then(data => console.log('Success:', data)) .catch(err => console.error('Error:', err)); }; return (
Login Reset
); } // Complex form with multiple field types function UserRegistrationForm() { const [error, setError] = useState(null); const onSubmit = async (data) => { try { const response = await fetch('/api/register', { method: 'POST', body: JSON.stringify(data), headers: { 'Content-Type': 'application/json' } }); if (!response.ok) throw new Error('Registration failed'); const result = await response.json(); console.log('User registered:', result); } catch (err) { setError(err.message); } }; return (
I agree to the terms and conditions Register
); } ``` -------------------------------- ### Toggle Group with Icons (React) Source: https://github.com/umami-software/react-zen/blob/master/src/content/docs/components/toggle-group.mdx Shows how to use icons within React ToggleGroupItems for a more visually descriptive interface. This example requires Icon and specific icon components (e.g., ExampleIcons.AlignLeft). Each item displays an icon instead of text. ```jsx ``` -------------------------------- ### Form Controls: Checkbox, RadioGroup, and Switch in React Zen Source: https://context7.com/umami-software/react-zen/llms.txt This example demonstrates binary and multiple choice form components using Checkbox for toggling agreement, RadioGroup for selecting options, and Switch for enabling features like notifications. It relies on React's useState for managing component states and imports from '@umami/react-zen' for UI elements. Inputs are controlled via props like isSelected and onChange; outputs reflect states in a display box. Limitations include dependency on the library's theme system via ZenProvider. ```tsx import { Checkbox, RadioGroup, Radio, Switch, Flexbox, Text } from '@umami/react-zen'; import { useState } from 'react'; function FormControlsExample() { const [checked, setChecked] = useState(false); const [radioValue, setRadioValue] = useState('option1'); const [switchOn, setSwitchOn] = useState(false); return ( {/* Checkbox */} I agree to the terms and conditions {/* Radio group */} Option 1 Option 2 Option 3 {/* Switch */} Enable notifications {/* Display state */} Checkbox: {checked ? 'Checked' : 'Unchecked'} Radio: {radioValue} Switch: {switchOn ? 'On' : 'Off'} ); } ``` -------------------------------- ### React Heading Component Sizing Examples Source: https://github.com/umami-software/react-zen/blob/master/src/content/docs/typography/heading.mdx Illustrates how to control the visual size of the Heading component using the 'size' prop. The 'size' prop accepts values from '1' to '6', corresponding to standard HTML heading levels. This allows for semantic and visual hierarchy control within the UI. Assumes the Heading component internally maps these sizes to appropriate HTML tags or CSS styles. ```jsx Heading 1 Heading 2 Heading 3 Heading 4 Heading 5 Heading 6 ``` -------------------------------- ### Menu with Separators in React JSX Source: https://github.com/umami-software/react-zen/blob/master/src/content/docs/components/menu.mdx This example adds MenuSeparator components to divide menu items into groups. Depends on Menu, MenuItem, and MenuSeparator from React Zen. Inputs are standard menu items; outputs grouped visual sections. Limited to horizontal separators without styling options shown. ```jsx One Two Three Four Five ``` -------------------------------- ### React Heading Component Letter Spacing Examples Source: https://github.com/umami-software/react-zen/blob/master/src/content/docs/typography/heading.mdx Demonstrates controlling letter spacing for the Heading component via the 'spacing' prop. The prop accepts numerical values (1-5), which likely translate to CSS letter-spacing values. This allows for fine-tuning the visual appearance and readability of headings. Assumes the Heading component applies these spacing adjustments via CSS. ```jsx Letter spacing 1 Letter spacing 2 Letter spacing 3 Letter spacing 4 Letter spacing 5 ``` -------------------------------- ### Basic List in React Source: https://github.com/umami-software/react-zen/blob/master/src/content/docs/components/list.mdx Creates a simple list with items. Uses the List and ListItem components to display a collection of items. No dependencies beyond React and React-Zen. ```react One Two Three Four Five ``` -------------------------------- ### Basic Icon Usage with SVG - React Source: https://github.com/umami-software/react-zen/blob/master/src/content/docs/components/icon.mdx Demonstrates the basic usage of the Icon component by wrapping an SVG element. It requires the Icon component and an SVG component (e.g., from ExampleIcons). ```jsx import { Icon } from 'your-icon-library'; import { Wifi } from 'your-icon-library/icons'; // Assuming icons are imported like this function MyComponent() { return ( ); } ``` -------------------------------- ### Render table with alignment Source: https://github.com/umami-software/react-zen/blob/master/src/content/docs/components/table.mdx Configures column alignment using align property. Supports 'start', 'center', and 'end' values. No additional dependencies needed. Does not affect row height or wrapping. ```jsx Name Type Date modified Games File folder 6/7/2020 Program Files File folder 4/7/2021
``` -------------------------------- ### Basic React Select Component Usage Source: https://github.com/umami-software/react-zen/blob/master/src/content/docs/components/select.mdx Demonstrates the fundamental usage of the React Select component to display a list of options triggered by a button. It requires an array of items and an optional placeholder. ```javascript import React from 'react'; import { Box, Select } from '@umami/design-system'; function App() { return (