### Install Ink UI Source: https://github.com/vadimdemedes/ink-ui/blob/main/readme.md Installs the Ink UI package using npm. This assumes you have already set up Ink. ```sh npm install @inkjs/ui ``` -------------------------------- ### Spinner Component Source: https://github.com/vadimdemedes/ink-ui/blob/main/readme.md Example usage of the Spinner component, which indicates that a process is ongoing and the CLI is waiting for completion. ```jsx import { Spinner } from '@inkjs/ui'; ; ``` -------------------------------- ### Spinner Usage Example Source: https://github.com/vadimdemedes/ink-ui/blob/main/docs/spinner.md Demonstrates how to use the Spinner component from @inkjs/ui in an Ink application. It shows the basic import and rendering with a label. ```tsx import React from 'react'; import {render, Box} from 'ink'; import {Spinner} from '@inkjs/ui'; function Example() { return ; } render(); ``` -------------------------------- ### Usage Example: ProgressBar Source: https://github.com/vadimdemedes/ink-ui/blob/main/docs/progress-bar.md Demonstrates how to use the ProgressBar component from '@inkjs/ui'. It simulates progress from 0 to 100 using `useState` and `useEffect` hooks, rendering the progress bar within an Ink `Box`. ```tsx import React, {useEffect, useState} from 'react'; import {render, Box} from 'ink'; import {ProgressBar} from '@inkjs/ui'; function Example() { const [progress, setProgress] = useState(0); useEffect(() => { if (progress === 100) { return; } const timer = setTimeout(() => { setProgress(progress + 1); }, 50); return () => { clearInterval(timer); }; }, [progress]); return ( ); } render(); ``` -------------------------------- ### ProgressBar Component Source: https://github.com/vadimdemedes/ink-ui/blob/main/readme.md Example usage of the ProgressBar component, an extension of Spinner that allows displaying a calculated progress percentage. ```jsx import { ProgressBar } from '@inkjs/ui'; // `progress` must be a number between 0 and 100 ; ``` -------------------------------- ### Select Component Source: https://github.com/vadimdemedes/ink-ui/blob/main/readme.md Example usage of the Select component, which displays a scrollable list of options for the user to choose from. ```jsx import { Select } from '@inkjs/ui'; Selected value: {value} ); } render(); ``` -------------------------------- ### PasswordInput Component Props Source: https://github.com/vadimdemedes/ink-ui/blob/main/docs/password-input.md API documentation for the PasswordInput component, detailing its available props, their types, default values, and functionality. ```APIDOC PasswordInput: Props: isDisabled: boolean Default: false Description: When disabled, user input is ignored. placeholder: string Description: Text to display when input is empty. onChange: Function Parameters: value: string Description: Input value. Description: Callback when input value changes. onSubmit: Function Parameters: value: string Description: Input value. Description: Callback when enter is pressed. ``` -------------------------------- ### EmailInput Props Source: https://github.com/vadimdemedes/ink-ui/blob/main/docs/email-input.md Documentation for the props available for the EmailInput component. ```APIDOC EmailInput Props: - isDisabled: boolean - Default: false - Description: When disabled, user input is ignored. - placeholder: string - Description: Text to display when input is empty. - defaultValue: string - Description: Default input value. - domains: string[] - Default: ["aol.com", "gmail.com", "yahoo.com", "hotmail.com", "live.com", "outlook.com", "icloud.com", "hey.com"] - Description: Domains of email providers to autocomplete. - onChange(value): Function - Parameters: - value: string - Description: Input value. - Description: Callback when input value changes. - onSubmit(value): Function - Parameters: - value: string - Description: Input value. - Description: Callback when enter is pressed. ``` -------------------------------- ### Basic Password Input with onChange Source: https://github.com/vadimdemedes/ink-ui/blob/main/docs/password-input.md Demonstrates the fundamental usage of PasswordInput, where the input value is masked with asterisks and updated via the onChange prop as the user types. ```tsx import React, {useState} from 'react'; import {render, Box, Text} from 'ink'; import {PasswordInput} from '@inkjs/ui'; import input from '../helpers/input.js'; function Example() { const [value, setValue] = useState(''); return ( Input value: "{value}" ); } render(); ``` -------------------------------- ### EmailInput Submit on Enter Source: https://github.com/vadimdemedes/ink-ui/blob/main/docs/email-input.md Demonstrates using the `onSubmit` prop to capture the final input value when the user presses Enter. ```tsx import React, {useState} from 'react'; import {render, Box, Text} from 'ink'; import {EmailInput} from '@inkjs/ui'; function Example() { const [value, setValue] = useState(''); return ( Input value: "{value}" ); } render(); ``` -------------------------------- ### EmailInput Autocomplete Source: https://github.com/vadimdemedes/ink-ui/blob/main/docs/email-input.md Illustrates the domain autocompletion feature of EmailInput, including customization via the `domains` prop. ```tsx import React, {useState} from 'react'; import {render, Box, Text} from 'ink'; import {EmailInput} from '@inkjs/ui'; function Example() { const [value, setValue] = useState(''); return ( Input value: "{value}" ); } render(); ``` -------------------------------- ### Ink UI Alert Component API Documentation Source: https://github.com/vadimdemedes/ink-ui/blob/main/docs/alert.md API reference for the Ink UI Alert component, detailing its available props, their types, and descriptions. This helps developers understand how to customize the appearance and content of alerts. ```APIDOC Alert Component API: Props: children: Type: ReactNode Description: The main message content to display within the alert. variant: Type: 'info' | 'success' | 'error' | 'warning' Description: Specifies the visual style and color of the alert. Defaults to 'info'. title: Type: string Description: An optional title that appears above the main message content, providing context. ``` -------------------------------- ### UnorderedList Component API Documentation Source: https://github.com/vadimdemedes/ink-ui/blob/main/docs/unordered-list.md Details the props available for the UnorderedList and UnorderedList.Item components. This documentation covers the expected children and their types for building list structures. ```APIDOC UnorderedList: Props: children: ReactNode Description: List items. Can contain UnorderedList.Item components or nested UnorderedList components. UnorderedList.Item: Props: children: ReactNode Description: List item content. Can contain Text, Box, or other Ink components, including nested UnorderedList components. ``` -------------------------------- ### TextInput: Component Props and API Reference Source: https://github.com/vadimdemedes/ink-ui/blob/main/docs/text-input.md Provides a comprehensive reference for the props available for the TextInput component, detailing their types, default values, and functionality. ```APIDOC TextInput Component Props: - isDisabled: boolean - Default: false - Description: When disabled, user input is ignored. - placeholder: string - Description: Text to display when input is empty. - defaultValue: string - Description: Default input value. - suggestions: string[] - Description: Suggestions to autocomplete the input value. Matching is case-sensitive. - onChange(value): Function - Description: Callback when input value changes. - Parameters: - value: string - Input value. - onSubmit(value): Function - Description: Callback when enter is pressed. - Parameters: - value: string - Input value. ``` -------------------------------- ### Ink.js UI OrderedList Component API Source: https://github.com/vadimdemedes/ink-ui/blob/main/docs/ordered-list.md API documentation for the `OrderedList` and `OrderedList.Item` components in Ink.js UI. It details the props available for customizing list rendering and content. ```APIDOC OrderedList: Props: children: ReactNode Description: List items. Can contain `OrderedList.Item` components. OrderedList.Item: Props: children: ReactNode Description: List item content. Can contain text or other Ink.js components, including nested `OrderedList`. ``` -------------------------------- ### EmailInput Default Value Source: https://github.com/vadimdemedes/ink-ui/blob/main/docs/email-input.md Shows how to set an initial value for the EmailInput component using the `defaultValue` prop. ```tsx import React, {useState} from 'react'; import {render, Box, Text} from 'ink'; import {EmailInput} from '@inkjs/ui'; function Example() { const [value, setValue] = useState(''); return ( Input value: "{value}" ); } render(); ``` -------------------------------- ### TextInput: Basic Usage with Ink.js Source: https://github.com/vadimdemedes/ink-ui/blob/main/docs/text-input.md Demonstrates the fundamental usage of the TextInput component for capturing single-line user input. It utilizes the `onChange` prop to update the application state as the user types. ```tsx import React, {useState} from 'react'; import {render, Box, Text} from 'ink'; import {TextInput} from '@inkjs/ui'; function Example() { const [value, setValue] = useState(''); return ( Input value: "{value}" ); } render(); ``` -------------------------------- ### UnorderedList Marker Configuration Source: https://github.com/vadimdemedes/ink-ui/blob/main/readme.md Illustrates how to include non-styling configuration within a component's theme. For `UnorderedList`, a `marker` configuration is provided as a function returning the character to be displayed before each list item. ```ts const theme = { config: () => ({ marker: '─', }), }; ``` -------------------------------- ### Render Nested Ordered List with Ink.js Source: https://github.com/vadimdemedes/ink-ui/blob/main/docs/ordered-list.md Demonstrates how to use the `OrderedList` component from `@inkjs/ui` to render a nested list of items. It requires `ink` and `@inkjs/ui` as dependencies. The component accepts `OrderedList.Item` children, which can themselves contain nested `OrderedList` components. ```tsx import React from 'react'; import {render, Box, Text} from 'ink'; import {OrderedList} from '@inkjs/ui'; function Example() { return ( Red Green Light Dark Blue ); } render(); ``` -------------------------------- ### TextInput: Setting Default Value with Ink.js Source: https://github.com/vadimdemedes/ink-ui/blob/main/docs/text-input.md Shows how to initialize the TextInput component with a predefined value using the `defaultValue` prop. This is useful for pre-filling forms or resuming input. ```tsx import React, {useState} from 'react'; import {render, Box, Text} from 'ink'; import {TextInput} from '@inkjs/ui'; function Example() { const [value, setValue] = useState('Jane'); return ( Input value: "{value}" ); } render(); ``` -------------------------------- ### Ink MultiSelect Basic Usage Source: https://github.com/vadimdemedes/ink-ui/blob/main/docs/multi-select.md Demonstrates the basic usage of the `MultiSelect` component. It's an uncontrolled component that allows users to select multiple options. The `onChange` prop is used to listen for value changes, and the selected values are displayed. ```tsx import React, {useState} from 'react'; import {render, Box, Text} from 'ink'; import {MultiSelect} from '@inkjs/ui'; function Example() { const [value, setValue] = useState([]); return ( Selected values: {value.join(', ')} ); } render(); ``` -------------------------------- ### Ink UI Select Default Value Configuration Source: https://github.com/vadimdemedes/ink-ui/blob/main/docs/select.md Illustrates how to set an initial selected option for the Select component using the `defaultValue` prop. This pre-selects an item when the component first renders. ```tsx import React, {useState} from 'react'; import {render, Box, Text} from 'ink'; import {Select} from '@inkjs/ui'; function Example() { const [value, setValue] = useState('green'); return (