### Development Setup Source: https://github.com/ensdomains/thorin/blob/main/README.md Clones the Thorin repository, installs dependencies using pnpm, and starts the development server. ```bash gh clone repo @ensdomains/thorin pnpm i pnpm dev ``` -------------------------------- ### Setup Thorin Project Source: https://github.com/ensdomains/thorin/blob/main/docs/src/guides/development.mdx Steps to clone the Thorin repository, install dependencies using pnpm, and start the development server. This is the initial setup required for contributing to the project. ```bash gh repo clone @ensdomains/thorin cd thorin pnpm i ``` -------------------------------- ### Install Thorin Package Source: https://github.com/ensdomains/thorin/blob/main/docs/src/reference/index.mdx Installs the Thorin UI library and its peer dependencies using pnpm. Ensure you have React and ReactDOM installed. ```sh pnpm i react react-dom @ensdomains/thorin@next ``` -------------------------------- ### Toast Component Live Example Source: https://github.com/ensdomains/thorin/blob/main/docs/src/reference/mdx/organisms/Toast.docs.mdx Demonstrates a live, interactive example of the Toast component. It includes a button to toggle the toast's visibility and shows how to configure its title, description, variant, and close behavior. ```tsx <> setState('toast', false)} > ``` -------------------------------- ### SkeletonGroup Live Example Source: https://github.com/ensdomains/thorin/blob/main/docs/src/reference/mdx/molecules/SkeletonGroup.docs.mdx Demonstrates the SkeletonGroup component in a live React example. It wraps multiple Skeleton components and allows toggling the loading state via a button. ```tsx Foo Bar Baz The quick brown fox jumped over the lazy dogs. {setDefaultState('loading', true)} ``` -------------------------------- ### Install Thorin Package Source: https://github.com/ensdomains/thorin/blob/main/README.md Installs the Thorin design system package along with its React dependencies using pnpm. ```bash pnpm i react react-dom @ensdomains/thorin@next ``` -------------------------------- ### Basic Dropdown Example Source: https://github.com/ensdomains/thorin/blob/main/docs/src/reference/mdx/molecules/Dropdown.docs.mdx Demonstrates a basic Dropdown component with a label and a list of items, including icons and click handlers. ```tsx null, color: 'text', icon: DotGridSVG, }, { label: 'Disconnect', onClick: () => null, color: 'red', icon: ExitSVG, }, ]} label="Account" /> ``` -------------------------------- ### Basic Thorin Card Usage Source: https://github.com/ensdomains/thorin/blob/main/docs/src/reference/mdx/atoms/Card.docs.mdx Shows a simple Card component containing a Heading and Typography. This example requires the Thorin UI library to be installed and configured. ```tsx Hello World The quick brown fox… ``` -------------------------------- ### Profile Component API Documentation Source: https://github.com/ensdomains/thorin/blob/main/docs/src/reference/mdx/molecules/Profile.docs.mdx Detailed API documentation for the Thorin Profile component, including all available props, their types, descriptions, and usage examples. ```APIDOC Profile: Props: address: string - The Ethereum wallet address to display. - Required. ensName?: string - The ENS name associated with the address. - Optional. avatar?: string - URL for a custom avatar image. - Optional. size?: "small" | "medium" | "large" - Controls the visual size of the profile display. - Defaults to "medium". dropdownItems?: DropdownItem[] - An array of objects to populate a dropdown menu. - Each object should conform to the DropdownItem interface. - Optional. showIndicator?: boolean - Controls the visibility of the indicator on dropdown items. - This prop is deprecated; use `showIndicator` within `dropdownItems` instead. - Optional. indicatorColor?: "blue" | "green" | "indigo" | "orange" | "pink" | "purple" | "red" | "teal" | "yellow" | "grey" | "accent" | "accentSecondary" | "accentSecondaryHover" | "accentTertiary" | "accentText" | "accentGradient" | "background" | "backgroundHide" | "backgroundSecondary" | "backgroundTertiary" | "border" | "borderSecondary" | "borderTertiary" | "foreground" | "foregroundSecondary" | "foregroundSecondaryHover" | "foregroundTertiary" | "groupBackground" | "groupBorder" | "gradients" | "text" | "textPlaceholder" | "textSecondary" | "textTertiary" - Sets a custom color for the indicator on dropdown items. - Optional. DropdownItem: label: string - The text label for the dropdown menu item. - Required. onClick: () => void - An event handler function to be called when the item is clicked. - Required. color?: "blue" | "green" | "indigo" | "orange" | "pink" | "purple" | "red" | "teal" | "yellow" | "grey" | "accent" | "accentSecondary" | "accentSecondaryHover" | "accentTertiary" | "accentText" | "accentGradient" | "background" | "backgroundHide" | "backgroundSecondary" | "backgroundTertiary" | "border" | "borderSecondary" | "borderTertiary" | "foreground" | "foregroundSecondary" | "foregroundSecondaryHover" | "foregroundTertiary" | "groupBackground" | "groupBorder" | "gradients" | "text" | "textPlaceholder" | "textSecondary" | "textTertiary" - The color of the label or associated icon. - Optional. icon?: React.ReactNode - An optional icon component to display next to the label. - Optional. showIndicator?: boolean - If true, displays an indicator next to the item. - Optional. ``` -------------------------------- ### Example Thorin Button Usage Source: https://github.com/ensdomains/thorin/blob/main/docs/src/reference/index.mdx Shows a practical example of using the Thorin Button component with a prefix icon (LockSVG) and primary variant, within a Box layout for alignment and spacing. ```tsx
``` -------------------------------- ### Setup ThemeProvider with Light Theme Source: https://github.com/ensdomains/thorin/blob/main/docs/src/reference/index.mdx Wraps the root of your React application with Thorin's ThemeProvider. It requires importing ThorinGlobalStyles and passing a theme object, such as lightTheme, to the provider. ```tsx import React, { useState } from 'react' import { ThemeProvider } from '@ensdomains/thorin' import '@ensdomains/thorin/dist/thorin.css' const App = () => { return ( {children} ) } ``` -------------------------------- ### Import Thorin Toggle Component Source: https://github.com/ensdomains/thorin/blob/main/docs/src/reference/mdx/molecules/Toggle.docs.mdx Imports the Toggle component from the '@ensdomains/thorin' library. This is the initial setup required before using the component in your application. ```tsx import { Toggle } from '@ensdomains/thorin' ``` -------------------------------- ### Basic FieldSet Example Source: https://github.com/ensdomains/thorin/blob/main/docs/src/reference/mdx/molecules/FieldSet.docs.mdx Demonstrates the fundamental usage of the FieldSet component, including a legend and nested Input elements for basic form structure. ```tsx
``` -------------------------------- ### Setup ThemeProvider with Dark Theme Source: https://github.com/ensdomains/thorin/blob/main/docs/src/reference/index.mdx Configures the application's root with Thorin's ThemeProvider, specifically utilizing the dark theme. This involves importing darkTheme and passing it to the ThemeProvider component. ```tsx import React, { useState } from 'react' import { ThemeProvider, darkTheme } from '@ensdomains/thorin' import '@ensdomains/thorin/dist/thorin.css' const App = () => { return ( {children} ) } ``` -------------------------------- ### Basic Thorin Select Example Source: https://github.com/ensdomains/thorin/blob/main/docs/src/reference/mdx/molecules/Select.docs.mdx Demonstrates a functional Thorin Select component with various options, including prefixes (like EthSVG, WalletSVG, MoonSVG, CopySVG) and a disabled option. It showcases the autocomplete and placeholder props for user interaction. ```tsx }, { value: '2', label: 'Two', prefix: }, ]} size="small" /> } label="Wallet Address" placeholder="0xA0Cf…251e" prefix="hello" suffix="world" /> ``` -------------------------------- ### ScrollBox Usage Example Source: https://github.com/ensdomains/thorin/blob/main/docs/src/reference/mdx/atoms/ScrollBox.docs.mdx Demonstrates how to use the ScrollBox component with custom height and content. It allows for scrollable content within a defined area. ```tsx Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque cursus posuere lacinia. Proin mollis nisl a lacus mollis, a volutpat tortor consectetur. Vivamus mattis augue eu nulla molestie, a euismod nunc placerat. Fusce vitae elit sed dolor auctor faucibus luctus condimentum risus. Aenean pharetra mauris sodales ligula sodales, a tristique magna rhoncus. Fusce sit amet arcu suscipit, molestie dolor nec, blandit ipsum. Sed sodales blandit elit eget ultrices. Aliquam non blandit lacus. Etiam eget tellus vitae risus vestibulum pulvinar at a nibh. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aliquam volutpat elit odio. Fusce placerat nibh nec ante aliquam, id dictum turpis tempor. Sed maximus quam ut ipsum blandit, vel lobortis neque venenatis. Maecenas dignissim massa nec risus vestibulum bibendum. Duis malesuada, est dapibus porttitor aliquet, massa arcu fermentum nunc, nec feugiat erat magna viverra orci. Suspendisse eu ultrices mauris. Aliquam scelerisque mollis orci id volutpat. Nunc ac vestibulum odio, vitae feugiat ligula. Nunc lacinia nisi in gravida volutpat. Vivamus dui ex, ornare ut ante vel, dapibus tempor est. Proin congue sapien non dolor hendrerit, in dignissim risus scelerisque. Pellentesque quis egestas ex. Suspendisse quis diam nec dui sagittis sollicitudin. In hac habitasse platea dictumst. Vestibulum vestibulum dignissim tincidunt. Donec congue nibh lectus, nec facilisis tortor tempus sit amet. Phasellus varius mattis metus porta posuere. Integer posuere dapibus libero. Maecenas euismod sem sed blandit consectetur. ``` -------------------------------- ### Basic CountdownCircle Usage Source: https://github.com/ensdomains/thorin/blob/main/docs/src/reference/mdx/molecules/CountdownCircle.docs.mdx Demonstrates the fundamental usage of the CountdownCircle component. It displays a countdown timer starting from a specified number of seconds. ```tsx ``` -------------------------------- ### Render ThemeToggle Component Source: https://github.com/ensdomains/thorin/blob/main/docs/src/reference/mdx/molecules/ThemeToggle.docs.mdx Renders the ThemeToggle component, which provides a user interface for selecting between three distinct theme states. This example shows a basic usage. ```tsx ``` -------------------------------- ### Basic Spinner Usage in Thorin Source: https://github.com/ensdomains/thorin/blob/main/docs/src/reference/mdx/atoms/Spinner.docs.mdx Demonstrates the basic import and usage of the Spinner component from the '@ensdomains/thorin' library. This is the default way to display a loading spinner. ```tsx import { Spinner } from '@ensdomains/thorin' ``` -------------------------------- ### Import Thorin Tooltip Component Source: https://github.com/ensdomains/thorin/blob/main/docs/src/reference/mdx/molecules/Tooltip.docs.mdx Imports the Tooltip component and its associated props type from the '@ensdomains/thorin' library. This is a common starting point for using the component in a React application. ```tsx import { Tooltip, TooltipProps } from '@ensdomains/thorin' ``` -------------------------------- ### Basic VisuallyHidden Usage Source: https://github.com/ensdomains/thorin/blob/main/docs/src/reference/mdx/atoms/VisuallyHidden.docs.mdx Renders the VisuallyHidden component with 'Hello World' as its content. This content will be visually hidden but still accessible to screen readers. ```tsx Hello World ``` -------------------------------- ### Toggle Component Disabled States Source: https://github.com/ensdomains/thorin/blob/main/docs/src/reference/mdx/molecules/Toggle.docs.mdx Demonstrates how to disable the Toggle component, preventing user interaction. This example shows disabled toggles in various sizes. ```tsx ``` -------------------------------- ### Createable Select Component Source: https://github.com/ensdomains/thorin/blob/main/docs/src/reference/mdx/molecules/Select.docs.mdx Demonstrates enabling the `createable` prop, which allows users to add new options to the Select component if they are not already present. ```tsx <> }, { value: '2', label: 'Two', prefix: }, { value: '3', label: 'Three', prefix: }, { value: '4', label: 'Four', prefix: , disabled: true, }, { value: '5', label: 'Four', prefix: }, ]} tabIndex="2" /> ``` -------------------------------- ### Thorin Tooltip Basic Usage with Placements Source: https://github.com/ensdomains/thorin/blob/main/docs/src/reference/mdx/molecules/Tooltip.docs.mdx Demonstrates the basic usage of the Thorin Tooltip component, showcasing different placement options (top, left, bottom, right) and their corresponding target elements. It highlights how to configure content, target IDs, and dimensions for various display scenarios. ```tsx
Content
} mobilePlacement="top" mobileWidth={250} placement="top" targetId="buttonIdTop" width={250} > Content} mobilePlacement="left" mobileWidth={50} placement="left" targetId="buttonIdLeft" width={100} > Content} mobilePlacement="bottom" mobileWidth={250} open placement="bottom" targetId="buttonIdBottom" width={250} > Content} mobilePlacement="right" mobileWidth={50} open placement="right" targetId="buttonIdRight" width={100} > ``` -------------------------------- ### SkeletonGroup Props Source: https://github.com/ensdomains/thorin/blob/main/docs/src/reference/mdx/molecules/SkeletonGroup.docs.mdx API documentation for the SkeletonGroup component's props. This includes details on how to manage the loading state and structure nested content. ```APIDOC SkeletonGroup: Props: loading: boolean - Description: Controls whether the skeletons are displayed or the actual content is rendered. - Type: boolean - Required: Yes children: ReactNode - Description: The content to be displayed, typically including multiple Skeleton components. - Type: ReactNode - Required: Yes Usage: The SkeletonGroup component is used to group related skeleton loaders. When the `loading` prop is true, all direct children that are Skeleton components will be displayed. When `loading` is false, the actual content within the Skeleton components will be rendered. Related Components: - Skeleton: Used as direct children within SkeletonGroup to represent individual loading states. ``` -------------------------------- ### CurrencyToggle Disabled States Source: https://github.com/ensdomains/thorin/blob/main/docs/src/reference/mdx/molecules/CurrencyToggle.docs.mdx Demonstrates the disabled state of the CurrencyToggle component. This includes examples of both checked and unchecked toggles in a disabled state, as well as different sizes. ```tsx ``` -------------------------------- ### Disabled RadioButton States Source: https://github.com/ensdomains/thorin/blob/main/docs/src/reference/mdx/molecules/RadioButton.docs.mdx Shows how to disable RadioButton components using the 'disabled' prop. This example presents both a checked and an unchecked disabled state, arranged vertically with spacing. ```tsx import { RadioButton, Box } from '@ensdomains/thorin' ``` -------------------------------- ### Build Components Library Source: https://github.com/ensdomains/thorin/blob/main/docs/src/guides/development.mdx Command to build the components library, which is necessary for changes to appear in the documentation files. This command compiles the React components into a usable library format. ```bash pnpm build:components ``` -------------------------------- ### Import CurrencyToggle Source: https://github.com/ensdomains/thorin/blob/main/docs/src/reference/mdx/molecules/CurrencyToggle.docs.mdx Imports the CurrencyToggle component from the @ensdomains/thorin library. This is typically the first step before using the component. ```tsx import { CurrencyToggle } from '@ensdomains/thorin' ``` -------------------------------- ### Run Tests Source: https://github.com/ensdomains/thorin/blob/main/docs/src/guides/development.mdx Command to execute the project's test suite. This is a crucial step in the development workflow to ensure code quality and functionality. ```bash pnpm test ``` -------------------------------- ### Thorin Tooltip Background Customization Source: https://github.com/ensdomains/thorin/blob/main/docs/src/reference/mdx/molecules/Tooltip.docs.mdx Demonstrates how to customize the background color of the Thorin Tooltip component using the 'background' prop. This example shows the tooltip with an 'indigo' background applied to various placements. ```tsx Content} mobilePlacement="top" mobileWidth={250} placement="top" targetId="buttonIdTop" width={250} background="indigo" > Content} mobilePlacement="left" mobileWidth={50} placement="left" targetId="buttonIdLeft" width={100} background="indigo" > Content} mobilePlacement="bottom" mobileWidth={250} open placement="bottom" targetId="buttonIdBottom" width={250} background="indigo" > Content} mobilePlacement="right" mobileWidth={50} open placement="right" targetId="buttonIdRight" width={100} background="indigo" > ``` -------------------------------- ### Thorin Card with Dividers Source: https://github.com/ensdomains/thorin/blob/main/docs/src/reference/mdx/atoms/Card.docs.mdx Demonstrates using the Card component with CardDivider elements to separate content sections. This example shows a card with a title and two content blocks separated by dividers. ```tsx Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. ``` -------------------------------- ### Import ThemeToggle Component Source: https://github.com/ensdomains/thorin/blob/main/docs/src/reference/mdx/molecules/ThemeToggle.docs.mdx Imports the ThemeToggle component from the @ensdomains/thorin library. This is typically the first step before using the component in your application. ```tsx import { ThemeToggle } from '@ensdomains/thorin' ``` -------------------------------- ### RadioButton Colors Source: https://github.com/ensdomains/thorin/blob/main/docs/src/reference/mdx/molecules/RadioButton.docs.mdx Illustrates how to apply different color themes to RadioButton components using the 'color' prop. This example showcases primary accent, red, and yellow color variants within a FieldSet. ```tsx import { RadioButton, Card, FieldSet } from '@ensdomains/thorin'
``` -------------------------------- ### Import Toast Component Source: https://github.com/ensdomains/thorin/blob/main/docs/src/reference/mdx/organisms/Toast.docs.mdx Imports the Toast component from the '@ensdomains/thorin' library. This is the initial step required to use the Toast component in your application. ```tsx import { Toast } from '@ensdomains/thorin' ``` -------------------------------- ### Clearable Input Component Source: https://github.com/ensdomains/thorin/blob/main/docs/src/reference/mdx/molecules/Input.docs.mdx Demonstrates the `clearable` prop for the Input component, which adds a button to easily clear the input's current value. Includes examples for both enabled and explicitly disabled clearing. ```tsx ``` -------------------------------- ### Basic Textarea Usage Source: https://github.com/ensdomains/thorin/blob/main/docs/src/reference/mdx/molecules/Textarea.docs.mdx Demonstrates the basic usage of the Textarea component with a label and placeholder. ```tsx