### Install Evergreen UI Framework Source: https://github.com/segmentio/evergreen/blob/master/docs/documentation/introduction/getting-started.mdx Instructions for installing the Evergreen UI framework using npm or yarn. Requires React v16.8.0 or higher. ```shell $ npm install evergreen-ui // OR $ yarn add evergreen-ui ``` -------------------------------- ### Complete Evergreen Table Example Source: https://github.com/segmentio/evergreen/blob/master/docs/documentation/components/table.mdx A comprehensive example demonstrating the usage of Evergreen's table components. It includes a Table, Table.Head, Table.Body, and Table.Row, with functionality for selecting rows and displaying data. The example also shows how to create a searchable header cell. ```jsx Last Activity ltv {profiles.map((profile) => ( alert(profile.name)}> {profile.name} {profile.lastActivity} {profile.ltv} ))}
``` -------------------------------- ### Default Autocomplete Example - React Source: https://github.com/segmentio/evergreen/blob/master/docs/documentation/components/autocomplete.mdx Renders a basic Autocomplete component with a list of fruits. It logs the selected item to the console via the onChange prop. This example demonstrates the fundamental setup for the Autocomplete component. ```jsx console.log(changedItem)} items={['Apple', 'Apricot', 'Banana', 'Cherry', 'Cucumber']} > {props => { const { getInputProps, getRef, inputValue } = props return ( ) }} ``` -------------------------------- ### Import Evergreen UI Components Source: https://github.com/segmentio/evergreen/blob/master/docs/documentation/introduction/getting-started.mdx Example of importing core components and utilities from the Evergreen UI library into a JavaScript project. ```javascript import { Button, Pane, Text, majorScale } from 'evergreen-ui' ``` -------------------------------- ### Fully Featured Autocomplete Example - React Source: https://github.com/segmentio/evergreen/blob/master/docs/documentation/components/autocomplete.mdx Presents a comprehensive Autocomplete setup with full width, flex layout, options title, onFocus event handling, filtering, and a button to trigger the autocomplete. This example is similar to the Combobox component and is intended for advanced use cases. ```jsx console.log(changedItem)} items={['Apple', 'Apricot', 'Banana', 'Cherry', 'Cucumber']} > {({ key, getInputProps, getToggleButtonProps, getRef, inputValue, openMenu, toggleMenu }) => ( )} ``` -------------------------------- ### Fully Featured SideSheet Example Source: https://github.com/segmentio/evergreen/blob/master/docs/documentation/components/side-sheet.mdx A comprehensive example showcasing a SideSheet with a header containing a title, subtitle, and a tab bar. The content area displays a card and supports scrolling. It also demonstrates advanced props like `containerProps` for custom styling. ```jsx function FullyFeaturedSidesheetExample() { const [isShown, setIsShown] = React.useState(false) const [selectedIndex, setSelectedIndex] = React.useState(0) return ( setIsShown(false)} containerProps={{ display: 'flex', flex: '1', flexDirection: 'column' }} > Title Optional description or sub title {['Traits', 'Event History', 'Identities'].map((tab, index) => ( setSelectedIndex(index)} > {tab} ))} Some content ) } ``` -------------------------------- ### Render basic Evergreen UI icon using JSX Source: https://github.com/segmentio/evergreen/blob/master/docs/documentation/foundations/icons.mdx Demonstrates how to import and render a single Evergreen UI icon component in a React application. No additional props are required for default rendering. This snippet uses the CrossIcon as an example. ```jsx ``` -------------------------------- ### Install Evergreen UI package with Yarn or npm Source: https://github.com/segmentio/evergreen/blob/master/README.md Installs the evergreen‑ui library using either Yarn or npm. This step is required before any Evergreen components can be imported. No additional configuration is needed after installation. ```sh $ yarn add evergreen-ui # or $ npm install --save evergreen-ui ``` -------------------------------- ### Migrate Nudge component to Pulsar with React Source: https://github.com/segmentio/evergreen/blob/master/docs/documentation/introduction/migrations/v7.mdx Example of migrating the deprecated Nudge component to the new Pulsar component in React. This involves replacing the import and adjusting the JSX structure. Tooltip functionality needs separate handling. ```jsx import React from 'react' -import { Nudge, Paragraph } from 'evergreen-ui' +import { Pulsar, Pane, Paragraph } from 'evergreen-ui' - - Hello world - + + + + Hello world + ``` ```jsx import React from 'react' -import { Nudge, Paragraph } from 'evergreen-ui' +import { Tooltip, Pulsar, Pane, Paragraph } from 'evergreen-ui' - - Hello world - + + + + + + Hello world + ``` -------------------------------- ### Replace imports with local deprecatedDefaultTheme using jscodeshift Source: https://github.com/segmentio/evergreen/blob/master/docs/documentation/introduction/migrations/v7.mdx This codemod helps replace imports from 'evergreen-ui' to a locally ejected deprecatedDefaultTheme object. It requires jscodeshift to be installed globally. ```bash npm i -g jscodeshift && npx jscodeshift -t node_modules/evergreen-ui/codemods/dist/6.0.0-7.0.0/replace-imports-with-local-path.js --localPath=themes/deprecated-default-theme --importName=deprecatedDefaultTheme --parser=tsx --extensions=js,jsx,ts,tsx fileOrDirectory --dry --print ``` -------------------------------- ### React JSX: Basic Overlay Example Source: https://github.com/segmentio/evergreen/blob/master/docs/documentation/components/overlay.mdx Demonstrates how to use the Overlay component in a React application. It shows how to control the visibility of the overlay using a state variable and a button click. This component requires React and the Evergreen UI library. ```jsx function BasicOverlayExample() { const [isShown, setIsShown] = React.useState(false) return ( ) } ``` -------------------------------- ### Pre Component Example (React) Source: https://github.com/segmentio/evergreen/blob/master/docs/documentation/foundations/typography.mdx The Pre component renders a chunk of preformatted text, defaulting to a 'pre' element. ```jsx
Preformatted text.
``` -------------------------------- ### Use Evergreen UI Components in JSX Source: https://github.com/segmentio/evergreen/blob/master/docs/documentation/introduction/getting-started.mdx Demonstrates how to use imported Evergreen UI components such as Pane, Button, and Text within a React JSX structure. Includes examples of layout and styling props. ```jsx This is a clickable Button ``` -------------------------------- ### Tooltip Positioning Examples (JSX) Source: https://github.com/segmentio/evergreen/blob/master/docs/documentation/components/tooltip.mdx Illustrates how to position the Tooltip component using the `position` prop. It provides examples for TOP, RIGHT, BOTTOM, and LEFT positions. This snippet requires Tooltip, IconButton, Arrow icons, Pane, and Position enum. ```jsx ``` -------------------------------- ### Basic SideSheet Example Source: https://github.com/segmentio/evergreen/blob/master/docs/documentation/components/side-sheet.mdx Demonstrates the fundamental usage of the SideSheet component. It includes state management for visibility and a button to trigger its appearance. The onCloseComplete prop is used to reset the visibility state. ```jsx function BasicSidesheetExample() { const [isShown, setIsShown] = React.useState(false) return ( setIsShown(false)}> Basic Example ) } ``` -------------------------------- ### Replace SidebarTab component using jscodeshift Source: https://github.com/segmentio/evergreen/blob/master/docs/documentation/introduction/migrations/v7.mdx This codemod programmatically updates instances of the SidebarTab component. It requires jscodeshift to be installed globally. ```bash npm i -g jscodeshift && npx jscodeshift -t node_modules/evergreen-ui/codemods/dist/6.0.0-7.0.0/replace-sidebar-tab.js --parser=tsx --extensions=js,jsx,ts,tsx fileOrDirectory --dry --print ``` -------------------------------- ### Replace Nudge component using jscodeshift Source: https://github.com/segmentio/evergreen/blob/master/docs/documentation/introduction/migrations/v7.mdx This codemod automatically updates instances of the Nudge component to the new Pulsar component where possible. It requires jscodeshift to be installed globally. ```bash npm i -g jscodeshift && npx jscodeshift -t node_modules/evergreen-ui/codemods/dist/6.0.0-7.0.0/replace-nudge.js --parser=tsx --extensions=js,jsx,ts,tsx fileOrDirectory --dry --print ``` -------------------------------- ### Basic Avatar Setup with Size Source: https://github.com/segmentio/evergreen/blob/master/docs/documentation/components/avatar.mdx Demonstrates how to create a basic avatar component using the 'name' and 'size' properties. The 'size' property controls both the width and height, and the initials will scale automatically. ```jsx ``` -------------------------------- ### Render dynamic Evergreen UI icon with Icon wrapper in JSX Source: https://github.com/segmentio/evergreen/blob/master/docs/documentation/foundations/icons.mdx Uses the generic Icon component to render any icon passed via the icon prop, allowing dynamic selection at runtime. Size can also be specified. This example renders the CogIcon with a size of 12 pixels. ```jsx ``` -------------------------------- ### Basic Pane Example with Properties Source: https://github.com/segmentio/evergreen/blob/master/docs/documentation/foundations/layers.mdx Demonstrates the basic usage of the Pane component, showcasing its ability to accept various props for styling and functionality. It maps directly to the Box component from ui-box, allowing for extensive customization. ```jsx console.log(ref)} background="tint2" border="muted" marginLeft={12} marginY={24} paddingTop={12} paddingX={40} width={120} height={120} cursor="help" onClick={() => alert('Works just like expected')} /> ``` -------------------------------- ### Code Component Examples (React) Source: https://github.com/segmentio/evergreen/blob/master/docs/documentation/foundations/typography.mdx The Code component, based on the Text component, renders a 'code' element and supports different sizes (300, 400, 500) and appearances like 'minimal'. ```jsx
The quick brown fox jumps over the lazy dog
The quick brown fox jumps over the lazy dog
The quick brown fox jumps over the lazy dog
The quick brown fox jumps over the lazy dog
The quick brown fox jumps over the lazy dog
The quick brown fox jumps over the lazy dog
``` -------------------------------- ### Menu with Icons in JSX Source: https://github.com/segmentio/evergreen/blob/master/docs/documentation/components/menu.mdx Example of a Menu with icons for each item, demonstrating visual enhancements. ```jsx Share... Move... Rename... Delete... } > ``` -------------------------------- ### Basic OrderedList Usage Source: https://github.com/segmentio/evergreen/blob/master/docs/documentation/foundations/typography.mdx This example shows the basic structure for using the OrderedList component, which renders a numbered list. It contains multiple ListItem components as children. ```jsx Lorem ipsum dolor sit amet Consectetur adipiscing elit Integer molestie lorem at massa Facilisis in pretium nisl aliquet ``` -------------------------------- ### Small Component Example (React) Source: https://github.com/segmentio/evergreen/blob/master/docs/documentation/foundations/typography.mdx The Small component is designed to be used exclusively within other text components, such as Paragraph. It renders text with a smaller visual size. ```jsx The small component can only be used in a other text component ``` -------------------------------- ### Basic CornerDialog Example in React JSX Source: https://github.com/segmentio/evergreen/blob/master/docs/documentation/components/corner-dialog.mdx This React JSX example demonstrates a basic implementation of the CornerDialog component from Evergreen. It uses React state to control visibility and includes a Button to trigger the dialog. Dependencies include React and Evergreen components; inputs are user clicks, outputs are the dialog display with title and content. ```jsx function BasicCornerDialogExample() { const [isShown, setIsShown] = React.useState(false) return ( setIsShown(false)} > The corner dialog component is used for new feature announcements and feedback requests from the user. ) } ``` -------------------------------- ### TextInputField with Label and Description Source: https://github.com/segmentio/evergreen/blob/master/docs/documentation/components/text-input.mdx Example of using the TextInputField component, which bundles a label, input, and description. It's suitable for standard form fields. ```jsx ``` -------------------------------- ### Basic Group with Buttons in React (JSX) Source: https://github.com/segmentio/evergreen/blob/master/docs/documentation/components/group.mdx Demonstrates a basic usage of the Group component with Button children. The example shows how to manage state for selected options and render buttons within a group. ```jsx function BasicGroupExample() { const options = React.useMemo( () => [ { label: 'Hourly', value: 'hourly' }, { label: 'Daily', value: 'daily' }, { label: 'Monthly', value: 'monthly' }, ], [] ) const [selectedValue, setSelectedValue] = React.useState('daily') return ( {options.map(({ label, value }) => ( ))} ) } ``` -------------------------------- ### Replace onKeyPress with onKeyDown on Table.Row component Source: https://github.com/segmentio/evergreen/blob/master/docs/documentation/introduction/migrations/v6.mdx Switches event handling from the deprecated onKeyPress to onKeyDown for Table.Row, ensuring consistent behavior across browsers. ```javascript {}} /> ``` -------------------------------- ### React RadioGroup Default Size Example Source: https://github.com/segmentio/evergreen/blob/master/docs/documentation/components/radio.mdx Demonstrates the default size usage of the RadioGroup component. It manages a group of radios, allowing selection of a single option from a predefined list. Requires React. ```jsx function DefaultRadioGroupExample() { const [options] = React.useState([ { label: 'Read-only', value: 'read-only' }, { label: 'Write', value: 'write' }, { label: 'Restricted', value: 'restricted' } ]) const [value, setValue] = React.useState('restricted') return ( setValue(event.target.value)} /> ) } ``` -------------------------------- ### Link Component Example (React) Source: https://github.com/segmentio/evergreen/blob/master/docs/documentation/foundations/typography.mdx The Link component is used for anchor links, rendering an 'a' element by default. It supports different size options (300, 400, 500) and color variations like 'neutral'. ```jsx
Default Neutral
``` -------------------------------- ### Customizing Button Base Styles with Evergreen Theming Source: https://github.com/segmentio/evergreen/blob/master/docs/documentation/introduction/theming.mdx Example of creating a custom button style by merging default theme with custom base styles, including padding, border-radius, background color, and pseudo-selectors for hover, active, and focus states. ```jsx function CustomButtonExample() { const theme = mergeTheme(defaultTheme, { components: { Button: { baseStyle: { color: 'white', paddingX: 12, paddingY: 8, borderRadius: 5, backgroundColor: 'indianred', selectors: { _hover: { backgroundColor: 'firebrick', }, _active: { backgroundColor: 'darkred', }, _focus: { boxShadow: '0 0 0 2px lightcoral', }, } }, }, }, }) return ( ) } ``` -------------------------------- ### Re‑implement BackButton component using Evergreen UI Button Source: https://github.com/segmentio/evergreen/blob/master/docs/documentation/introduction/migrations/v6.mdx Provides a custom BackButton component that mimics the removed component, using forwardRef, memo, and Evergreen's Button with ArrowLeftIcon. Exported for reuse across the application. ```javascript import React, { forwardRef, memo } from 'react' import { ArrowLeftIcon, Button } from 'evergreen-ui' const BackButton = memo( forwardRef(function BackButton({ children = 'Back', ...props }, ref) { return ( ) }) ) BackButton.propTypes = { /** Composes the Button component as the base. */ ...Button.propTypes } export default BackButton ``` -------------------------------- ### Strong Component Examples (React) Source: https://github.com/segmentio/evergreen/blob/master/docs/documentation/foundations/typography.mdx The Strong component renders strong text, defaulting to a 'strong' element. Ensure the 'size' property is set when used within other text components like Paragraph for consistent styling. ```jsx
The quick brown fox jumps over the lazy dog
The quick brown fox jumps over the lazy dog
The quick brown fox jumps over the lazy dog
``` -------------------------------- ### Replace marginTop="default" with majorScale on Heading component Source: https://github.com/segmentio/evergreen/blob/master/docs/documentation/introduction/migrations/v6.mdx Updates Heading (or Paragraph) marginTop usage to the scalable majorScale value, as the default theme no longer supports the "default" keyword. ```javascript ... ``` -------------------------------- ### Eject deprecatedDefaultTheme using jscodeshift Source: https://github.com/segmentio/evergreen/blob/master/docs/documentation/introduction/migrations/v7.mdx This codemod ejects the deprecatedDefaultTheme object into your local codebase, allowing for easier migration. It requires jscodeshift to be installed globally. ```bash npm i -g jscodeshift && npx jscodeshift -t node_modules/evergreen-ui/codemods/dist/6.0.0-7.0.0/eject-deprecated-default-theme.js --parser=tsx --extensions=js,jsx,ts,tsx fileOrDirectory --dry --print ``` -------------------------------- ### React Radio Component States Example Source: https://github.com/segmentio/evergreen/blob/master/docs/documentation/components/radio.mdx Shows different states of the Radio component, including default, checked, and disabled. These are typically used within a radio group to manage user selections. Requires React and Pane component. ```jsx ``` -------------------------------- ### Migrate SidebarTab to Tab component with React Source: https://github.com/segmentio/evergreen/blob/master/docs/documentation/introduction/migrations/v7.mdx Example demonstrating how to replace the removed SidebarTab component with the Tab component and the 'direction="vertical"' prop in React. ```jsx import React from 'react' -import { SidebarTab } from 'evergreen-ui' +import { Tab } from 'evergreen-ui' -Settings +Settings ``` -------------------------------- ### Evergreen UI Button Component Examples (React) Source: https://context7.com/segmentio/evergreen/llms.txt Demonstrates various configurations for the Evergreen UI Button component, including different appearances, intents, sizes, loading states, icon usage, and integration with Box layout props. It requires React and specific components from 'evergreen-ui'. ```javascript import React, { useState } from 'react' import { Button, IconButton, TextDropdownButton, AddIcon, TrashIcon } from 'evergreen-ui' function ButtonExamples() { const [loading, setLoading] = useState(false) const handleSave = async () => { setLoading(true) try { await fetch('/api/save', { method: 'POST' }) } finally { setLoading(false) } } return (
{/* Basic buttons with appearances */} {/* Sizes */} {/* Loading state */} {/* Icon button */} {/* Text dropdown button */} Options {/* With Box props for layout */}
) } ``` -------------------------------- ### All Pane Elevation Options Source: https://github.com/segmentio/evergreen/blob/master/docs/documentation/foundations/layers.mdx Provides a comprehensive example of all available elevation levels for the Pane component, ranging from 0 to 4. Each level offers a distinct visual effect, suitable for different UI elements like toasts and dialogs. ```jsx Elevation 0 Flat Panes Elevation 1 Floating Panes Elevation 2 Popovers and Dropdowns Elevation 3 Toasts Elevation 4 Dialog ``` -------------------------------- ### SSR Setup with Evergreen UI for Next.js Source: https://context7.com/segmentio/evergreen/llms.txt This snippet demonstrates how to configure Next.js for Server-Side Rendering using Evergreen UI. It includes setting up `_document.js` to extract and inject styles and `_app.js` to provide the theme. This ensures styles are rendered correctly on the server and hydrated on the client, improving performance and SEO. ```javascript // pages/_document.js (Next.js) import Document, { Html, Head, Main, NextScript } from 'next/document' import { extractStyles } from 'evergreen-ui' export default class MyDocument extends Document { static async getInitialProps(ctx) { const initialProps = await Document.getInitialProps(ctx) const { css, hydrationScript } = extractStyles() return { ...initialProps, css, hydrationScript } } render() { const { css, hydrationScript } = this.props return ( {/* Inject extracted CSS */}
${htmlContent}
${hydrationScript} ` res.send(html) }) app.listen(3000) ``` -------------------------------- ### Resize Evergreen UI icon with size prop in JSX Source: https://github.com/segmentio/evergreen/blob/master/docs/documentation/foundations/icons.mdx Shows how to change an icon's dimensions by providing the size prop. The value is interpreted as pixel size for the SVG. This example renders a BanCircleIcon at 40 pixels. ```jsx ``` -------------------------------- ### Basic Tablist Implementation Source: https://github.com/segmentio/evergreen/blob/master/docs/documentation/components/tabs.mdx Demonstrates the basic usage of Tablist and Tab components to create a standard tabbed interface. It manages tab selection state and renders corresponding content panels. Assumes React and Evergreen UI library are available. ```jsx function BasicTabsExample() { const [selectedIndex, setSelectedIndex] = React.useState(0) const [tabs] = React.useState(['Traits', 'Event History', 'Identities']) return ( {tabs.map((tab, index) => ( setSelectedIndex(index)} > {tab} ))} {tabs.map((tab, index) => ( Panel {tab} ))} ) } ``` -------------------------------- ### Render Evergreen Button component in a React app Source: https://github.com/segmentio/evergreen/blob/master/README.md Demonstrates importing and rendering a Button component from evergreen‑ui within a React application. The example assumes a standard Create React App setup and renders the button into the root DOM node. ```javascript import React from 'react' import ReactDOM from 'react-dom' import { Button } from 'evergreen-ui' ReactDOM.render(, document.getElementById('root')) ``` -------------------------------- ### Implement Autocomplete and Combobox in React with Evergreen UI Source: https://context7.com/segmentio/evergreen/llms.txt Demonstrates how to create searchable input components with custom rendering and state management. Includes examples for simple autocomplete, combobox with object items, and custom input rendering. Uses React hooks for state management and Evergreen UI components. ```javascript import React, { useState } from 'react'\nimport {\n Autocomplete,\n Combobox,\n Pane,\n Text,\n Avatar,\n majorScale\n} from 'evergreen-ui'\n\nfunction AutocompleteExample() {\n const [selectedUser, setSelectedUser] = useState('')\n const [selectedItem, setSelectedItem] = useState(null)\n\n const users = [\n 'John Doe',\n 'Jane Smith',\n 'Bob Johnson',\n 'Alice Williams',\n 'Charlie Brown'\n ]\n\n const items = [\n { id: 1, name: 'React', category: 'Framework' },\n { id: 2, name: 'Vue', category: 'Framework' },\n { id: 3, name: 'Angular', category: 'Framework' },\n { id: 4, name: 'TypeScript', category: 'Language' },\n { id: 5, name: 'JavaScript', category: 'Language' }\n ]\n\n return (\n \n {/* Simple autocomplete */}\n \n {props => {\n const { getInputProps, getRef, inputValue } = props\n return (\n \n )\n }}\n \n\n \n Selected: {selectedUser || 'None'}\n \n\n {/* Combobox with custom rendering */}\n item ? item.name : ''}\n onChange={setSelectedItem}\n marginTop={majorScale(3)}\n />\n\n {selectedItem && (\n \n Selected: {selectedItem.name}
\n Category: {selectedItem.category}\n
\n )}\n\n {/* Autocomplete with custom item renderer */}\n \n {props => {\n const { getInputProps, getRef, inputValue, openMenu } = props\n return (\n openMenu()\n })}\n style={{\n width: '100%',\n padding: 8,\n fontSize: 14,\n border: '1px solid #ccc',\n borderRadius: 4\n }}\n />\n )\n }}\n \n
\n )\n} ``` -------------------------------- ### Update Component Theme Selectors in Evergreen Source: https://github.com/segmentio/evergreen/blob/master/docs/documentation/introduction/migrations/v7.mdx This example shows how to migrate pseudoselectors in custom themes for Evergreen components. Previously defined pseudoselectors like _isSelectable and _disabled should now be nested within a 'selectors' object. This change aligns with ui-box@5.2.0's new selectors API for defining prop-based states. ```diff const baseStyle = { outline: 'none', textDecoration: 'none', display: 'flex', position: 'relative', paddingX: 12, + selectors: { _isSelectable: { cursor: 'pointer' }, _disabled: { cursor: 'not-allowed', userSelect: 'none' } + } } ``` -------------------------------- ### Non-table Empty State Example (React) Source: https://github.com/segmentio/evergreen/blob/master/docs/documentation/patterns/empty-states.mdx Shows an example of a non-table empty state, typically used for content outside of tables. This example includes a dark background for contrast and a primary call to action. It utilizes the EmptyState component and requires appropriate icons. ```jsx } iconBgColor="#F8E3DA" description="To see these sources, request access." primaryCta={Request access} /> ``` -------------------------------- ### Create a searchable Table with React and Evergreen UI Source: https://context7.com/segmentio/evergreen/llms.txt Demonstrates how to implement a searchable and sortable table component using Evergreen UI's Table. Includes filtering functionality and avatar integration. Requires React and evergreen-ui as dependencies. ```javascript import React, { useState } from 'react' import { Table, Avatar } from 'evergreen-ui' function TableExample() { const [searchQuery, setSearchQuery] = useState('') const [data, setData] = useState([ { id: 1, name: 'John Doe', email: 'john@example.com', role: 'Admin' }, { id: 2, name: 'Jane Smith', email: 'jane@example.com', role: 'User' }, { id: 3, name: 'Bob Johnson', email: 'bob@example.com', role: 'Editor' } ]) const filteredData = data.filter(item => item.name.toLowerCase().includes(searchQuery.toLowerCase()) ) return ( Name Email Role {filteredData.map(user => ( {user.name} {user.email} {user.role} ))}
) } ``` ```javascript function VirtualTableExample() { const items = Array.from({ length: 10000 }, (_, i) => ({ id: i, name: `User ${i}`, email: `user${i}@example.com` })) return ( Name Email {items.map(item => ( {item.name} {item.email} ))}
) } ``` -------------------------------- ### Using Default Theme in Evergreen Components Source: https://github.com/segmentio/evergreen/blob/master/docs/documentation/introduction/theming.mdx Demonstrates how to apply the default Evergreen theme to various components like Heading, Button, Alert, and Checkbox using the ThemeProvider. ```jsx Using Default Theme ``` -------------------------------- ### Evergreen Table Text Header Cell Example Source: https://github.com/segmentio/evergreen/blob/master/docs/documentation/components/table.mdx An example of using the Table.TextHeaderCell component in Evergreen for standard text headers within a table. This is a common component for labeling columns. ```jsx Age Email ``` -------------------------------- ### Migrate from classicTheme to defaultTheme in Evergreen Source: https://github.com/segmentio/evergreen/blob/master/docs/documentation/introduction/migrations/v7.mdx This code snippet demonstrates the migration from using `classicTheme` to `defaultTheme` with Evergreen's `ThemeProvider`. The `classicTheme` has been removed in v7, and applications should now use the `defaultTheme` for consistent styling. This change simplifies the theming system and aligns with modern visual design principles. ```diff import React from 'react' -import { classicTheme, ThemeProvider } from 'evergreen-ui' +import { defaultTheme, ThemeProvider } from 'evergreen-ui' const App: React.FC = (props) => { const { children } = props - return {children} + return {children} } ``` -------------------------------- ### Full width TagInput component styling Source: https://github.com/segmentio/evergreen/blob/master/docs/documentation/components/tag-input.mdx Illustrates width customization using the width prop set to 100%. Demonstrates responsive container sizing for tag input. Retains standard controlled behavior with state management. ```jsx function FullWidthTagInputExample() { const [values, setValues] = React.useState(['Kauri', 'Willow']) return ( { setValues(values) }} /> ) } ```