diff --git a/.github/workflows/trigger-ui-update-docs.yml b/.github/workflows/trigger-ui-update-docs.yml new file mode 100644 index 0000000000..f5f8be606b --- /dev/null +++ b/.github/workflows/trigger-ui-update-docs.yml @@ -0,0 +1,25 @@ +name: Trigger gluestack-style-website | Create PR when pushed to master + +on: + pull_request: + branches: + - patch + +jobs: + build: + name: Dispatch to 'gluestack-style-website' + runs-on: ubuntu-latest + steps: + - name: Emit repository_dispatch + uses: mvasigh/dispatch-action@main + with: + # You should create a personal access token and store it in your repository + token: ${{ secrets.MY_GITHUB_TOKEN }} + repo: ui-website + owner: gluestack + event_type: build_ui_docs + message: | + { + "repo": "ui", + "branch": "${{ github.head_ref }}" + } diff --git a/.prettierignore b/.prettierignore index a56a7ef437..3984825263 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,2 +1,2 @@ node_modules - +*.mdx \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 1fb8e30a75..c2896b9710 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -17,7 +17,13 @@ "prettier.ignorePath": ".prettierignore", // If true, puts the `>` of a multi-line jsx element at the end of the last line instead of being alone on the next line "editor.wordWrap": "on", - "cSpell.words": ["Actionsheet", "gluestack", "nativewind", "themeable"], + "cSpell.words": [ + "Actionsheet", + "gluestack", + "nativewind", + "tailwindcss", + "themeable" + ], "cSpell.enableFiletypes": ["mdx"], "tailwindCSS.experimental.classRegex": [ ["tva\\((([^()]*|\\([^()]*\\))*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"] diff --git a/example/storybook-nativewind/.storybook/preview.js b/example/storybook-nativewind/.storybook/preview.js index 31f92fb93f..9b4bbf185a 100644 --- a/example/storybook-nativewind/.storybook/preview.js +++ b/example/storybook-nativewind/.storybook/preview.js @@ -3,12 +3,12 @@ import { DocsContainer } from '@storybook/addon-docs/blocks'; import { OverlayProvider } from '@gluestack-ui/overlay'; import { ToastProvider } from '@gluestack-ui/toast'; -import { GluestackUIProvider as GluestackUIWithNativewindProvider } from '../src/components-example/nativewind/GluestackUIProvider'; +import { GluestackUIProvider as GluestackUIWithNativewindProvider } from '../src/core-components/nativewind/gluestack-ui-provider'; // global css getting resolved from babel.config.js import 'global.css'; -import { GluestackUIProvider as GluestackUIWithGluestackStyleProvider } from '../src/components-example/themed/GluestackUIProvider'; +import { GluestackUIProvider as GluestackUIWithGluestackStyleProvider } from '../src/core-components/themed/gluestack-ui-provider'; import gstheme from './gstheme'; import { themes } from '@storybook/theming'; diff --git a/example/storybook-nativewind/babel.config.js b/example/storybook-nativewind/babel.config.js index a6d51a3d52..2f1016e1de 100644 --- a/example/storybook-nativewind/babel.config.js +++ b/example/storybook-nativewind/babel.config.js @@ -14,8 +14,8 @@ module.exports = function (api) { alias: { '@/components/ui': process.env.STYLE_ENGINE === 'nativewind' - ? path.resolve(__dirname, './src/components-example/nativewind') - : path.resolve(__dirname, './src/components-example/themed'), + ? path.resolve(__dirname, './src/core-components/nativewind') + : path.resolve(__dirname, './src/core-components/themed'), 'global.css': process.env.STYLE_ENGINE === 'nativewind' @@ -46,6 +46,10 @@ module.exports = function (api) { __dirname, '../../packages/unstyled/button/src' ), + '@gluestack-ui/link': path.resolve( + __dirname, + '../../packages/unstyled/link/src' + ), '@gluestack-ui/accordion': path.resolve( __dirname, '../../packages/unstyled/accordion/src' diff --git a/example/storybook-nativewind/src/components-example/nativewind/Box/index.tsx b/example/storybook-nativewind/src/components-example/nativewind/Box/index.tsx deleted file mode 100644 index e4c5400c8b..0000000000 --- a/example/storybook-nativewind/src/components-example/nativewind/Box/index.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import React from 'react'; -import { View } from 'react-native'; -import { tva } from '@gluestack-ui/nativewind-utils'; - -const boxStyle = tva({}); -const Box = React.forwardRef(({ className, ...props }: any, ref) => { - return ( - - ); -}); - -Box.displayName = 'Box'; -export { Box }; diff --git a/example/storybook-nativewind/src/components-example/nativewind/Link/index.tsx b/example/storybook-nativewind/src/components-example/nativewind/Link/index.tsx deleted file mode 100644 index 10812670c3..0000000000 --- a/example/storybook-nativewind/src/components-example/nativewind/Link/index.tsx +++ /dev/null @@ -1,53 +0,0 @@ -import { createLink } from '@gluestack-ui/link'; -import { Pressable, Text, Platform } from 'react-native'; -import { - tva, - withStyleContextAndStates, - withStyleContext, -} from '@gluestack-ui/nativewind-utils'; -import React from 'react'; -import { cssInterop } from 'nativewind'; -export const UILink = createLink({ - // @ts-ignore - Root: - Platform.OS === 'web' - ? withStyleContext(Pressable) - : withStyleContextAndStates(Pressable), - Text: Text, -}); - -cssInterop(UILink, { className: 'style' }); -cssInterop(UILink.Text, { className: 'style' }); - -const linkStyle = tva({ - base: 'web:outline-0 web:disabled:cursor-not-allowed web:focus-visible:outline-2 web:focus-visible:outline-primary-700 web:focus-visible:outline', -}); - -const linkTextStyle = tva({ - base: 'underline text-info-700 hover:text-info-600 hover:no-underline active:text-info-700 disabled:opacity-40', -}); - -export const Link = React.forwardRef(({ className, ...props }: any, ref) => { - return ( - - ); -}); - -export const LinkText = React.forwardRef( - ({ className, ...props }: any, ref) => { - return ( - - ); - } -); diff --git a/example/storybook-nativewind/src/components-example/nativewind/VStack/index.tsx b/example/storybook-nativewind/src/components-example/nativewind/VStack/index.tsx deleted file mode 100644 index bca5d509c8..0000000000 --- a/example/storybook-nativewind/src/components-example/nativewind/VStack/index.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import React from 'react'; -import { tva } from '@gluestack-ui/nativewind-utils'; -import { View } from 'react-native'; - -const vstackStyle = tva({ - base: 'flex-column', - variants: { - space: { - 'xs': 'gap-1', - 'sm': 'gap-2', - 'md': 'gap-3', - 'lg': 'gap-4', - 'xl': 'gap-5', - '2xl': 'gap-6', - '3xl': 'gap-7', - '4xl': 'gap-8', - }, - reversed: { - true: 'flex-col-reverse', - }, - }, -}); - -const VStack = ({ className, space, reversed, ...props }: any) => { - return ( - - ); -}; - -VStack.displayName = 'VStack'; - -export { VStack }; diff --git a/example/storybook-nativewind/src/components-example/themed/Link/index.tsx b/example/storybook-nativewind/src/components-example/themed/Link/index.tsx deleted file mode 100644 index f95f84ce27..0000000000 --- a/example/storybook-nativewind/src/components-example/themed/Link/index.tsx +++ /dev/null @@ -1,54 +0,0 @@ -import { styled } from '@gluestack-style/react'; -import { createLink } from '@gluestack-ui/link'; -import { Pressable, Text } from 'react-native'; - -const StyledRoot = styled( - Pressable, - { - _web: { - 'outlineWidth': 0, - ':disabled': { - cursor: 'not-allowed', - }, - ':focusVisible': { - outlineWidth: 2, - outlineColor: '$primary700', - outlineStyle: 'solid', - }, - }, - _text: { - ':hover': { - color: '$info600', - textDecorationLine: 'none', - }, - - ':active': { - color: '$info700', - }, - - ':disabled': { - opacity: 0.4, - }, - }, - }, - { - componentName: 'Link', - } as const -); - -const StyledText = styled( - Text, - { - textDecorationLine: 'underline', - color: '$info700', - }, - { - ancestorStyle: ['_text'], - } as const -); - -export const Link = createLink({ - Root: StyledRoot, - Text: StyledText, -}); -export const LinkText = Link.Text; diff --git a/example/storybook-nativewind/src/components-example/themed/index.ts b/example/storybook-nativewind/src/components-example/themed/index.ts deleted file mode 100644 index fbef73b84a..0000000000 --- a/example/storybook-nativewind/src/components-example/themed/index.ts +++ /dev/null @@ -1,48 +0,0 @@ -export * from './Button'; -export * from './Accordion'; -export * from './Actionsheet'; -export * from './Alert'; -export * from './AlertDialog'; -export * from './Avatar'; -export * from './Badge'; -export * from './Box'; -export * from './Card'; -export * from './FlatList'; -export * from './Center'; -export * from './Checkbox'; -export * from './HStack'; -export * from './Pressable'; -export * from './Icon'; -export * from './Heading'; -export * from './Divider'; -export * from './Fab'; -export * from './FormControl'; -export * from './Input'; -export * from './InputAccessoryView'; -export * from './Image'; -export * from './KeyboardAvoidingView'; -export * from './LinearGradient'; -export * from './Link'; -export * from './Menu'; -export * from './Modal'; -export * from './Popover'; -export * from './Progress'; -export * from './Text'; -export * from './Radio'; -export * from './ScrollView'; -export * from './SafeAreaView'; -export * from './Select'; -export * from './Slider'; -export * from './Spinner'; -export * from './StatusBar'; -export * from './SectionList'; -export * from './Switch'; -export * from './Textarea'; -export * from './Toast'; -export * from './Tooltip'; -export * from './View'; -export * from './VStack'; -export { GluestackUIProvider } from './GluestackUIProvider'; -export * from './VirtualizedList'; -export * from './RefreshControl'; -export * from './ImageBackground'; diff --git a/example/storybook-nativewind/src/components/Accordion/Accordion.tsx b/example/storybook-nativewind/src/components/Accordion/Accordion.tsx index 992e06a004..a22452fb6f 100644 --- a/example/storybook-nativewind/src/components/Accordion/Accordion.tsx +++ b/example/storybook-nativewind/src/components/Accordion/Accordion.tsx @@ -8,7 +8,7 @@ import { AccordionIcon, AccordionContent, AccordionContentText, -} from '@/components/ui/Accordion'; +} from '@/components/ui/accordion'; import { ChevronDownIcon, ChevronUpIcon, diff --git a/example/storybook-nativewind/src/components/Accordion/index.stories.mdx b/example/storybook-nativewind/src/components/Accordion/index.stories.mdx index 900983f754..e52f1eb2da 100644 --- a/example/storybook-nativewind/src/components/Accordion/index.stories.mdx +++ b/example/storybook-nativewind/src/components/Accordion/index.stories.mdx @@ -42,7 +42,7 @@ import { transformedCode } from '../../utils'; -import Wrapper from '../../components-example/themed/Wrapper'; +import Wrapper from '../../core-components/themed/Wrapper'; This is an illustration of **Accordion** component. diff --git a/example/storybook-nativewind/src/components/Accordion/index.themed.stories.mdx b/example/storybook-nativewind/src/components/Accordion/index.themed.stories.mdx index 5ac2900f98..7fbc58b159 100644 --- a/example/storybook-nativewind/src/components/Accordion/index.themed.stories.mdx +++ b/example/storybook-nativewind/src/components/Accordion/index.themed.stories.mdx @@ -1,5 +1,4 @@ --- - title: Accordion | gluestack-ui | Installation, Usage, and API description: The Accordion component is a versatile and interactive user interface element, designed to efficiently organize and present content in a compact space. @@ -9,7 +8,7 @@ pageTitle: Accordion pageDescription: The Accordion component is a versatile and interactive user interface element, designed to efficiently organize and present content in a compact space. showHeader: true - +--- import { Meta } from '@storybook/addon-docs'; @@ -28,7 +27,7 @@ import { ChevronUpIcon, PlusIcon, MinusIcon, -} from '../../components-example/themed'; +} from '../../core-components/themed'; import { AppProvider, CodePreview, @@ -40,8 +39,8 @@ import { Alert, } from '@gluestack/design-system'; import { transformedCode } from '../../utils'; -import { config } from '../../components-example/themed/GluestackUIProvider/config'; -import Wrapper from '../../components-example/themed/Wrapper'; +import { config } from '../../core-components/themed/gluestack-ui-provider/config'; +import Wrapper from '../../core-components/themed/Wrapper'; # Accordion diff --git a/example/storybook-nativewind/src/components/Actionsheet/Actionsheet.tsx b/example/storybook-nativewind/src/components/Actionsheet/Actionsheet.tsx index 3d4aacd699..298d687f37 100644 --- a/example/storybook-nativewind/src/components/Actionsheet/Actionsheet.tsx +++ b/example/storybook-nativewind/src/components/Actionsheet/Actionsheet.tsx @@ -34,7 +34,7 @@ import { ActionsheetSectionList, ActionsheetSectionHeaderText, ActionsheetVirtualizedList, -} from '@/components/ui/Actionsheet'; +} from '@/components/ui/actionsheet'; const ActionsheetBasic = ({ showActionsheetProp, ...props }: any) => { const [showActionsheet, setShowActionsheet] = React.useState(false); diff --git a/example/storybook-nativewind/src/components/Actionsheet/index.nw.storiesold.mdx b/example/storybook-nativewind/src/components/Actionsheet/index.nw.storiesold.mdx index 622b5fde49..a47636e23b 100644 --- a/example/storybook-nativewind/src/components/Actionsheet/index.nw.storiesold.mdx +++ b/example/storybook-nativewind/src/components/Actionsheet/index.nw.storiesold.mdx @@ -65,17 +65,17 @@ import { Alert, } from '@gluestack/design-system'; import { config } from '@gluestack-ui/config'; -import Wrapper from '../../components-example/nativewind/Wrapper'; +import Wrapper from '../../core-components/nativewind/Wrapper'; import { CollapsibleCode } from '@gluestack/design-system'; This is an illustration of **Actionsheet** component. - +< Wrapper config = { config } > setShowActionsheet(!showActionsheet); @@ -114,8 +114,8 @@ function App(){ transformCode: (code) => { return transformedCode(code, 'function', 'App'); }, - scope: { - Button, + scope: { + Button, ButtonText, ButtonText, Actionsheet, @@ -128,11 +128,12 @@ function App(){ Wrapper, Box, }, - }} - /> + } +} +/> -
+
## Installation @@ -147,9 +148,11 @@ npm i @gluestack-ui/actionsheet ### Step 2: Copy and paste the following code into your project. - ```jsx - %%-- File: components-example/nativewind/Actionsheet/index.tsx --%% - ``` + +```jsx +%%-- File: core-components/nativewind/actionsheet/index.tsx --%% +``` + ### Step 3: Update the import paths to match your project setup. @@ -159,7 +162,7 @@ npm i @gluestack-ui/actionsheet To use this component in your project, include the following import statement in your file. ```jsx -import { Actionsheet } from '@/components/ui/Actionsheet'; +import { Actionsheet } from '@/components/ui/actionsheet'; ``` ```jsx @@ -559,11 +562,11 @@ We have outlined the various features that ensure the Actionsheet component is a Explore the comprehensive details of the Actionsheet in this document, including its implementation details, checklist, and potential future additions. Dive into the thought process behind the component and gain insights into its development journey. +src = "https://www.figma.com/embed?embed_host=share&url=https%3A%2F%2Fwww.figma.com%2Fproto%2FNcXOxqKbdnGsLQNex3H76u%2Fgluestack-UI-handbook%3Fpage-id%3D222%253A12635%26type%3Ddesign%26node-id%3D225-14926%26viewport%3D-207%252C386%252C0.13%26scaling%3Dcontain%26starting-point-node-id%3D225%253A14926" +allowFullScreen + > diff --git a/example/storybook-nativewind/src/components/Center/index.themed.stories.mdx b/example/storybook-nativewind/src/components/Center/index.themed.stories.mdx index b9f3729ac7..ab5ab27951 100644 --- a/example/storybook-nativewind/src/components/Center/index.themed.stories.mdx +++ b/example/storybook-nativewind/src/components/Center/index.themed.stories.mdx @@ -14,24 +14,24 @@ import { Meta } from '@storybook/addon-docs'; -import { Center } from './Center'; -import { Text } from '../../components-example/themed/Text'; +import { Center } from '../../core-components/themed'; +import { Text } from '../../core-components/themed'; import { transformedCode } from '../../utils'; import { AppProvider, CodePreview, Table } from '@gluestack/design-system'; -import Wrapper from '../../components-example/themed/Wrapper'; +import Wrapper from '../../core-components/themed/Wrapper'; import { CollapsibleCode } from '@gluestack/design-system'; This is an illustration of **Center** component. <> This is the center. @@ -41,17 +41,18 @@ This is an illustration of **Center** component. transformCode: (code) => { return transformedCode(code); }, - scope: { - Wrapper, + scope: { + Wrapper, Center, Text, }, - argsType: {}, - }} - /> + argsType: { }, + } +} +/> -
+
## Installation @@ -59,8 +60,8 @@ This is an illustration of **Center** component. -```jsx - %%-- File: components-example/themed/Center/index.tsx --%% +```jsx +%%-- File: core-components/themed/center/index.tsx --%% ``` @@ -72,7 +73,7 @@ This is an illustration of **Center** component. To use this component in your project, include the following import statement in your file. ```jsx -import { Center } from '@/components/ui/Center'; +import { Center } from '@/components/ui/center'; ``` ```jsx @@ -92,11 +93,11 @@ It inherits all the properties of React Native's [View](https://reactnative.dev/ Explore the comprehensive details of the Center in this document, including its implementation details, checklist, and potential future additions. Dive into the thought process behind the component and gain insights into its development journey. +src = "https://www.figma.com/embed?embed_host=share&url=https%3A%2F%2Fwww.figma.com%2Fproto%2FNcXOxqKbdnGsLQNex3H76u%2Fgluestack-UI-handbook%3Fpage-id%3D222%253A12635%26type%3Ddesign%26node-id%3D225-14926%26viewport%3D-207%252C386%252C0.13%26scaling%3Dcontain%26starting-point-node-id%3D225%253A14926" +allowFullScreen + > diff --git a/example/storybook-nativewind/src/components/Checkbox/Checkbox.tsx b/example/storybook-nativewind/src/components/Checkbox/Checkbox.tsx index bad00ef33c..fdf1cff838 100644 --- a/example/storybook-nativewind/src/components/Checkbox/Checkbox.tsx +++ b/example/storybook-nativewind/src/components/Checkbox/Checkbox.tsx @@ -5,15 +5,15 @@ import { CheckboxIndicator, CheckboxLabel, CheckboxGroup, -} from '@/components/ui/Checkbox'; -import { Text } from '@/components/ui/Text'; -import { RemoveIcon, Icon, CheckIcon } from '@/components/ui/Icon'; -import { FormControl } from '@/components/ui/FormControl'; -import { Center } from '@/components/ui/Center'; -import { VStack } from '@/components/ui/VStack'; -import { HStack } from '@/components/ui/HStack'; -import { Heading } from '@/components/ui/Heading'; -import { Box } from '@/components/ui/Box'; +} from '@/components/ui/checkbox'; +import { Text } from '@/components/ui/text'; +import { RemoveIcon, Icon, CheckIcon } from '@/components/ui/icon'; +import { FormControl } from '@/components/ui/form-control'; +import { Center } from '@/components/ui/center'; +import { VStack } from '@/components/ui/vstack'; +import { HStack } from '@/components/ui/hstack'; +import { Heading } from '@/components/ui/heading'; +import { Box } from '@/components/ui/box'; const CheckboxGroupBasic = ({ ...props }: any) => { return ( diff --git a/example/storybook-nativewind/src/components/Checkbox/index.nw.stories.mdx b/example/storybook-nativewind/src/components/Checkbox/index.nw.stories.mdx index cf9b7252d0..893439e22b 100644 --- a/example/storybook-nativewind/src/components/Checkbox/index.nw.stories.mdx +++ b/example/storybook-nativewind/src/components/Checkbox/index.nw.stories.mdx @@ -30,7 +30,7 @@ import { HStack, Heading, Box, -} from './Checkbox'; +} from '../../core-components/nativewind'; import { useState, useRef } from 'react'; import { transformedCode } from '../../utils'; import { @@ -41,7 +41,7 @@ import { InlineCode, } from '@gluestack/design-system'; -import Wrapper from '../../components-example/nativewind/Wrapper'; +import Wrapper from '../../core-components/nativewind/Wrapper'; import { CollapsibleCode } from '@gluestack/design-system'; This is an illustration of **Checkbox** component. @@ -105,7 +105,11 @@ npm i @gluestack-ui/checkbox ### Step 2: Copy and paste the following code into your project. - ```jsx %%-- File: components-example/nativewind/Checkbox/index.tsx --%% ``` + +```jsx +%%-- File: core-components/nativewind/checkbox/index.tsx --%% +``` + ### Step 3: Update the import paths to match your project setup. @@ -115,7 +119,7 @@ npm i @gluestack-ui/checkbox To use this component in your project, include the following import statement in your file. ```jsx -import { Checkbox } from '@/components/ui/Checkbox'; +import { Checkbox } from '@/components/ui/checkbox'; ``` ```jsx diff --git a/example/storybook-nativewind/src/components/Checkbox/index.themed.stories.mdx b/example/storybook-nativewind/src/components/Checkbox/index.themed.stories.mdx index 6405b3687b..5d02e583ce 100644 --- a/example/storybook-nativewind/src/components/Checkbox/index.themed.stories.mdx +++ b/example/storybook-nativewind/src/components/Checkbox/index.themed.stories.mdx @@ -20,17 +20,17 @@ import { CheckboxIndicator, CheckboxIcon, CheckboxLabel, -} from './Checkbox'; +} from '../../core-components/themed'; import { Text, RemoveIcon, FormControl, Icon, CheckIcon, -} from '@gluestack-ui/themed'; +} from '../../core-components/themed'; import { useState, useRef } from 'react'; -import { Center, VStack } from '@gluestack-ui/themed'; -import { HStack, Heading, Box } from '@gluestack-ui/themed'; +import { Center, VStack } from '../../core-components/themed'; +import { HStack, Heading, Box } from '../../core-components/themed'; import { transformedCode } from '../../utils'; import { @@ -41,7 +41,7 @@ import { InlineCode, } from '@gluestack/design-system'; -import Wrapper from '../../components-example/themed/Wrapper'; +import Wrapper from '../../core-components/themed/Wrapper'; import { CollapsibleCode } from '@gluestack/design-system'; This is an illustration of **Checkbox** component. @@ -105,7 +105,11 @@ npm i @gluestack-ui/checkbox ### Step 2: Copy and paste the following code into your project. - ```jsx %%-- File: components-example/themed/Checkbox/index.tsx --%% ``` + +```jsx +%%-- File: core-components/themed/checkbox/index.tsx --%% +``` + ### Step 3: Update the import paths to match your project setup. @@ -115,7 +119,7 @@ npm i @gluestack-ui/checkbox To use this component in your project, include the following import statement in your file. ```jsx -import { Checkbox } from '@/components/ui/Checkbox'; +import { Checkbox } from '@/components/ui/checkbox'; ``` ```jsx diff --git a/example/storybook-nativewind/src/components/Divider/Divider.tsx b/example/storybook-nativewind/src/components/Divider/Divider.tsx index 10b32281b5..358d58ce16 100644 --- a/example/storybook-nativewind/src/components/Divider/Divider.tsx +++ b/example/storybook-nativewind/src/components/Divider/Divider.tsx @@ -1,32 +1,27 @@ import React from 'react'; -import { - Text, - VStack, - HStack, - Box, - Center, - Heading, - Button, - ButtonText, -} from '@gluestack-ui/themed'; -import { Divider } from '@/components/ui/Divider'; +import { Divider } from '@/components/ui/divider'; +import { HStack } from '@/components/ui/hstack'; +import { Heading } from '@/components/ui/heading'; +import { Center } from '@/components/ui/center'; +import { Text } from '@/components/ui/text'; +import { VStack } from '@/components/ui/vstack'; +import { Box } from '@/components/ui/box'; +import { Button, ButtonText } from '@/components/ui/button'; const DividerBasic = ({ ...props }) => { return ( - + Firefox - + Chrome @@ -44,8 +39,8 @@ export { HStack, Divider, Box, - Center, Heading, Button, ButtonText, + Center, }; diff --git a/example/storybook-nativewind/src/components/Divider/index.nw.stories.mdx b/example/storybook-nativewind/src/components/Divider/index.nw.stories.mdx index 7bd0289d71..f60172e36a 100644 --- a/example/storybook-nativewind/src/components/Divider/index.nw.stories.mdx +++ b/example/storybook-nativewind/src/components/Divider/index.nw.stories.mdx @@ -14,16 +14,17 @@ import { Meta } from '@storybook/addon-docs'; -import { Divider } from './Divider'; import { + Divider, Center, Text, + HStack, + VStack, + Box, + Heading, Button, ButtonText, - VStack, - HStack, -} from '@gluestack-ui/themed'; -import { Box, Heading } from '@gluestack-ui/themed'; +} from '../../core-components/nativewind'; import { transformedCode } from '../../utils'; import { AppProvider, @@ -32,7 +33,7 @@ import { TableContainer, InlineCode, } from '@gluestack/design-system'; -import Wrapper from '../../components-example/nativewind/Wrapper'; +import Wrapper from '../../core-components/nativewind/Wrapper'; import { CollapsibleCode } from '@gluestack/design-system'; This is an illustration of **Divider** component. @@ -82,9 +83,11 @@ npm i @gluestack-ui/divider ### Step 2: Copy and paste the following code into your project. - ```jsx - %%-- File: components-example/nativewind/Divider/index.tsx --%% - ``` + +```jsx +%%-- File: core-components/nativewind/divider/index.tsx --%% +``` + ### Step 3: Update the import paths to match your project setup. @@ -94,7 +97,7 @@ npm i @gluestack-ui/divider To use this component in your project, include the following import statement in your file. ```jsx -import { Divider } from '@/components/ui/Divider'; +import { Divider } from '@/components/ui/divider'; ``` ```jsx @@ -195,3 +198,285 @@ const Divider = createDivider({ export default () => ; ``` --> + +### Examples + +The Examples section provides visual representations of the different variants of the component, allowing you to quickly and easily determine which one best fits your needs. Simply copy the code and integrate it into your project. + +#### Variants + +A Divider component with different layouts offers versatile options for visually dividing content in various arrangements, such as horizontal or vertical orientations, enabling flexible and visually appealing designs for organizing and structuring elements within a user interface. + + + + + Simple + + Easy + + Beautiful + + + Firefox + + Chrome + + + `, + transformCode: (code) => { + return transformedCode(code); + }, + scope: { + Wrapper, + Divider, + VStack, + HStack, + Text, + }, + argsType: {}, + }} + /> + + +#### Orientation + +A Divider component with a specified divider orientation allows for clear visual separation of content, either horizontally or vertically, providing a structured and organized layout within a user interface. + + + + + + HEALTH + + + Benefits of Oranges + + + Oranges are a great source of vitamin C, which is essential for a healthy immune system. + + + + Wade Warrem + + + + 6th Oct, 2019 + + + + 5 mins read + + + + + + + TECHNOLOGY + + + How AI can benefit your business + + + AI can automate tasks and processes, allowing for increasing efficiency and productivity. + + + + Wade Warrem + + + + 6th Oct, 2019 + + + + 5 mins read + + + + + `, + transformCode: (code) => { + return transformedCode(code); + }, + scope: { + Wrapper, + Divider, + Box, + Text, + VStack, + Heading, + HStack, + }, + argsType: {}, + }} + /> + + +#### With & Without Inset + +A Divider component used with or without inset adds visual hierarchy and distinction by creating a dividing line either with or without indentation, providing options for organizing and structuring content within a user interface. + + + + + + + + + + + + + + + + + + + `, + transformCode: (code) => { + return transformedCode(code); + }, + scope: { + Wrapper, + HStack, + Divider, + Button, + ButtonText, + VStack, + }, + argsType: {}, + }} + /> + + +#### Adding content within a Divider + +A Divider component with added content allows for the inclusion of additional text or elements alongside the dividing line, enhancing the visual and informational aspects of the divider while providing a seamless integration of content within a user interface. + + + + + Search Results + + + + + TECHNOLOGY + + + How AI can benefit your business + + + AI can automate tasks and processes, allowing for increasing efficiency and productivity. + + + + + 5 mins read + + + + + `, + transformCode: (code) => { + return transformedCode(code); + }, + scope: { + Wrapper, + HStack, + Divider, + Box, + Heading, + Text, + }, + argsType: {}, + }} + /> + diff --git a/example/storybook-nativewind/src/components/Divider/index.themed.stories.mdx b/example/storybook-nativewind/src/components/Divider/index.themed.stories.mdx index 39c91fe999..ae5670aea7 100644 --- a/example/storybook-nativewind/src/components/Divider/index.themed.stories.mdx +++ b/example/storybook-nativewind/src/components/Divider/index.themed.stories.mdx @@ -24,7 +24,7 @@ import { Text, Button, ButtonText, -} from '../../components-example/themed'; +} from '../../core-components/themed'; import { AppProvider, CodePreview, @@ -34,7 +34,7 @@ import { CollapsibleCode, } from '@gluestack/design-system'; import { transformedCode } from '../../utils'; -import Wrapper from '../../components-example/themed/Wrapper'; +import Wrapper from '../../core-components/themed/Wrapper'; This is an illustration of **Divider** component. @@ -83,7 +83,11 @@ npm i @gluestack-ui/divider ### Step 2: Copy and paste the following code into your project. - ```jsx %%-- File: ../../components-example/themed/Divider/index.tsx --%% ```` + +```jsx +%%-- File: core-components/themed/divider/index.tsx --%% +```` + ### Step 3: Update the import paths to match your project setup. @@ -93,7 +97,7 @@ npm i @gluestack-ui/divider To use this component in your project, include the following import statement in your file. ```jsx -import { Divider } from '@/components/ui/Divider'; +import { Divider } from '@/components/ui/divider'; ``` ```jsx diff --git a/example/storybook-nativewind/src/components/Fab/Fab.tsx b/example/storybook-nativewind/src/components/Fab/Fab.tsx index 9c55173c66..2b60b98241 100644 --- a/example/storybook-nativewind/src/components/Fab/Fab.tsx +++ b/example/storybook-nativewind/src/components/Fab/Fab.tsx @@ -1,21 +1,21 @@ import React from 'react'; -import { Fab, FabIcon, FabLabel } from '@/components/ui/Fab'; -import { Avatar, AvatarImage } from '@/components/ui/Avatar'; -import { AddIcon, MenuIcon, SearchIcon, CheckIcon } from '@/components/ui/Icon'; -import { Box } from '@/components/ui/Box'; +import { Fab, FabIcon, FabLabel } from '@/components/ui/fab'; +import { Avatar, AvatarImage } from '@/components/ui/avatar'; +import { AddIcon, MenuIcon, SearchIcon, CheckIcon } from '@/components/ui/icon'; +import { Box } from '@/components/ui/box'; import { Checkbox, CheckboxIndicator, CheckboxLabel, CheckboxIcon, -} from '@/components/ui/Checkbox'; -import { Link } from '@/components/ui/Link'; -import { VStack } from '@/components/ui/VStack'; -import { HStack } from '@/components/ui/HStack'; -import { Heading } from '@/components/ui/Heading'; -import { Text } from '@/components/ui/Text'; -import { Divider } from '@/components/ui/Divider'; -import { Image } from '@/components/ui/Image'; +} from '@/components/ui/checkbox'; +import { Link } from '@/components/ui/link'; +import { VStack } from '@/components/ui/vstack'; +import { HStack } from '@/components/ui/hstack'; +import { Heading } from '@/components/ui/heading'; +import { Text } from '@/components/ui/text'; +import { Divider } from '@/components/ui/divider'; +import { Image } from '@/components/ui/image'; import { EditIcon, ShoppingCartIcon } from 'lucide-react-native'; const FabBasic = (props: any) => { diff --git a/example/storybook-nativewind/src/components/Fab/index.nw.stories.mdx b/example/storybook-nativewind/src/components/Fab/index.nw.stories.mdx index 5633f87f88..4e643b0c71 100644 --- a/example/storybook-nativewind/src/components/Fab/index.nw.stories.mdx +++ b/example/storybook-nativewind/src/components/Fab/index.nw.stories.mdx @@ -38,7 +38,7 @@ import { Image, EditIcon, ShoppingCartIcon, -} from './Fab'; +} from '../../core-components/nativewind'; import { transformedCode } from '../../utils'; import { AppProvider, @@ -48,7 +48,7 @@ import { InlineCode, } from '@gluestack/design-system'; -import Wrapper from '../../components-example/nativewind/Wrapper'; +import Wrapper from '../../core-components/nativewind/Wrapper'; import { CollapsibleCode } from '@gluestack/design-system'; This is an illustration of **Fab** component. @@ -125,7 +125,11 @@ npm i @gluestack-ui/fab ### Step 2: Copy and paste the following code into your project. - ```jsx %%-- File: components-example/nativewind/Fab/index.tsx --%% ``` + +```jsx +%%-- File: core-components/nativewind/fab/index.tsx --%% +``` + ### Step 3: Update the import paths to match your project setup. diff --git a/example/storybook-nativewind/src/components/Fab/index.stories.mdx b/example/storybook-nativewind/src/components/Fab/index.stories.mdx index 24874f1681..be7ef575da 100644 --- a/example/storybook-nativewind/src/components/Fab/index.stories.mdx +++ b/example/storybook-nativewind/src/components/Fab/index.stories.mdx @@ -39,7 +39,7 @@ import { InlineCode, } from '@gluestack/design-system'; -import Wrapper from '../../components-example/themed/Wrapper'; +import Wrapper from '../../core-components/themed/Wrapper'; This is an illustration of **Fab** component. diff --git a/example/storybook-nativewind/src/components/Fab/index.themed.stories.mdx b/example/storybook-nativewind/src/components/Fab/index.themed.stories.mdx index 63fe497b42..6f5a2b1c74 100644 --- a/example/storybook-nativewind/src/components/Fab/index.themed.stories.mdx +++ b/example/storybook-nativewind/src/components/Fab/index.themed.stories.mdx @@ -14,7 +14,7 @@ import { Meta } from '@storybook/addon-docs'; -import { Fab, FabIcon, FabLabel } from '../../components-example/themed/Fab'; +import { Fab, FabIcon, FabLabel } from '../../core-components/themed/fab'; import { Checkbox, CheckboxIndicator, @@ -25,12 +25,12 @@ import { Image, Box, Link, -} from '@gluestack-ui/themed'; -import { HStack, VStack, Avatar, AvatarImage } from '@gluestack-ui/themed'; -import { Heading, Text, Divider } from '@gluestack-ui/themed'; +} from '../../core-components/themed'; +import { HStack, VStack, Avatar, AvatarImage } from '../../core-components/themed'; +import { Heading, Text, Divider } from '../../core-components/themed'; import { transformedCode } from '../../utils'; -import { AddIcon, EditIcon } from '@gluestack-ui/themed'; -import { SearchIcon } from '@gluestack-ui/themed'; +import { AddIcon, EditIcon } from '../../core-components/themed'; +import { SearchIcon } from '../../core-components/themed'; import { AppProvider, CodePreview, @@ -39,7 +39,7 @@ import { InlineCode, } from '@gluestack/design-system'; -import Wrapper from '../../components-example/themed/Wrapper'; +import Wrapper from '../../core-components/themed/Wrapper'; import { CollapsibleCode } from '@gluestack/design-system'; This is an illustration of **Fab** component. @@ -120,7 +120,11 @@ npm i @gluestack-ui/fab ### Step 2: Copy and paste the following code into your project. - ```jsx %%-- File: components-example/themed/Fab/index.tsx --%% ``` + +```jsx +%%-- File: core-components/themed/fab/index.tsx --%% +``` + ### Step 3: Update the import paths to match your project setup. diff --git a/example/storybook-nativewind/src/components/FormControl/FormControl.tsx b/example/storybook-nativewind/src/components/FormControl/FormControl.tsx index cfb5001776..dcea6a4323 100644 --- a/example/storybook-nativewind/src/components/FormControl/FormControl.tsx +++ b/example/storybook-nativewind/src/components/FormControl/FormControl.tsx @@ -56,10 +56,10 @@ import { FormControlError, FormControlErrorIcon, FormControlErrorText, -} from '@/components/ui/FormControl'; +} from '@/components/ui/form-control'; import { AlertCircleIcon } from 'lucide-react-native'; -import { Input, InputField } from '@/components/ui/Input'; +import { Input, InputField } from '@/components/ui/input'; const FormControlBasic = ({ ...props }: any) => { return ( diff --git a/example/storybook-nativewind/src/components/FormControl/index.nw.stories.mdx b/example/storybook-nativewind/src/components/FormControl/index.nw.stories.mdx index 4b755853b7..bafb924717 100644 --- a/example/storybook-nativewind/src/components/FormControl/index.nw.stories.mdx +++ b/example/storybook-nativewind/src/components/FormControl/index.nw.stories.mdx @@ -15,28 +15,22 @@ import { Meta } from '@storybook/addon-docs'; import { - Icon, + FormControlHelper, + FormControlError, + Input, + Box, + Center, + AlertCircleIcon, CircleIcon, CheckIcon, -} from '@gluestack-ui/themed'; -import { - FormControl, - FormControlLabel, + ChevronDownIcon, FormControlLabelText, - FormControlHelper, FormControlHelperText, - FormControlError, FormControlErrorIcon, FormControlErrorText, - Input, InputField, - AlertCircleIcon, -} from './FormControl'; -import { Center, Text as FormControlText, Heading } from '@gluestack-ui/themed'; -import { - ChevronDownIcon, - Button, - ButtonText, + Text as FormControlText, + Heading, Radio, RadioGroup, RadioIcon, @@ -47,8 +41,6 @@ import { CheckboxIndicator, CheckboxIcon, CheckboxLabel, -} from '@gluestack-ui/themed'; -import { Textarea, TextareaInput, Select, @@ -62,8 +54,6 @@ import { SelectDragIndicator, SelectItem, Switch, -} from '@gluestack-ui/themed'; -import { Slider, SliderTrack, SliderFilledTrack, @@ -77,8 +67,12 @@ import { ModalFooter, HStack, VStack, -} from '@gluestack-ui/themed'; -import { transformedCode } from '../../utils'; + FormControl, + FormControlLabel, + Icon, + Button, + ButtonText, +} from '../../core-components/nativewind'; import { AppProvider, CodePreview, @@ -86,20 +80,18 @@ import { TableContainer, Text, InlineCode, + CollapsibleCode, } from '@gluestack/design-system'; - +import { transformedCode } from '../../utils'; import { useState } from 'react'; - -import Wrapper from '../../components-example/nativewind/Wrapper'; -import { Box } from '../../components-example/nativewind/Box'; -import { CollapsibleCode } from '@gluestack/design-system'; +import Wrapper from '../../core-components/nativewind/Wrapper'; This is an illustration of **FormControl** component. - + @@ -121,6 +113,7 @@ This is an illustration of **FormControl** component. @@ -149,32 +142,96 @@ This is an illustration of **FormControl** component. AlertCircleIcon, Box, }, - argsType: { - size: { - control: 'select', - options: ['sm', 'md', 'lg'], - default: 'md', - }, - isDisabled: { - control: 'boolean', - default: false, - }, - isInvalid: { - control: 'boolean', - default: false, - }, - isReadOnly: { - control: 'boolean', - default: false, - }, - isRequired: { - control: 'boolean', - default: false, - }, + argsType: {}, + }} + /> + + +#### Form Control with Radio + +The Radio Component can be incorporated within the FormControl. + + + + + + Favourite fruit + + + + + + + + + + + + Mango + + + + + + + + + + Apple + + + + + + + + + + Orange + + + + + + + Choose the fruit you like the most + + + + `, + transformCode: (code) => { + return transformedCode(code); + }, + scope: { + Wrapper, + FormControl, + FormControlLabel, + FormControlLabelText, + FormControlHelper, + FormControlHelperText, + FormControlError, + FormControlErrorIcon, + FormControlErrorText, + Icon, + Radio, + RadioGroup, + RadioIcon, + RadioIndicator, + RadioLabel, + AlertCircleIcon, + VStack, + CircleIcon, + Heading, }, + argsType: {}, }} /> - +
@@ -191,9 +248,11 @@ npm i @gluestack-ui/form-control ### Step 2: Copy and paste the following code into your project. - ```jsx - %%-- File: components-example/nativewind/FormControl/index.tsx --%% - ``` + +```jsx +%%-- File: core-components/nativewind/form-control/index.tsx --%% +``` + ### Step 3: Update the import paths to match your project setup. @@ -203,7 +262,7 @@ npm i @gluestack-ui/form-control To use this component in your project, include the following import statement in your file. ```jsx -import { FormControl } from '@/components/ui/FormControl'; +import { FormControl } from '@/components/ui/form-control'; ``` ```jsx @@ -388,3 +447,597 @@ Explore the comprehensive details of the Input in this document, including its i src="https://www.figma.com/embed?embed_host=share&url=https%3A%2F%2Fwww.figma.com%2Fproto%2FNcXOxqKbdnGsLQNex3H76u%2F%25C2%25A0%25F0%259F%2593%259Agluestack-UI-handbook%3Ftype%3Ddesign%26node-id%3D5030-22048%26t%3DIS25mxEIlIP9OacJ-1%26scaling%3Dscale-down%26page-id%3D5030%253A19919%26starting-point-node-id%3D5030%253A22048%26mode%3Ddesign" allowfullscreen > --> + +### Examples + +The Examples section provides visual representations of the different variants of the component, allowing you to quickly and easily determine which one best fits your needs. Simply copy the code and integrate it into your project. + +#### Form Control with Input + +The Input Component can be incorporated within the FormControl. + + + + + + Password + + + + + + + Must be at least 6 characters. + + + + + + At least 6 characters are required. + + + + + `, + transformCode: (code) => { + return transformedCode(code); + }, + scope: { + Wrapper, + FormControl, + FormControlLabel, + FormControlLabelText, + FormControlHelper, + FormControlHelperText, + FormControlError, + FormControlErrorIcon, + FormControlErrorText, + Icon, + Input, + InputField, + AlertCircleIcon, + Box, + }, + argsType: { + size: { + control: 'select', + options: ['sm', 'md', 'lg'], + default: 'md', + }, + isDisabled: { + control: 'boolean', + default: false, + }, + isInvalid: { + control: 'boolean', + default: false, + }, + isReadOnly: { + control: 'boolean', + default: false, + }, + isRequired: { + control: 'boolean', + default: false, + }, + }, + }} + /> + + +#### Form Control with Checkbox + +The Checkbox Component can be incorporated within the FormControl. + + + + + + Sign up for newsletters + + + + + + + + + + + + Daily Bits + + + + + + + + + + Event Updates + + + + + + + + + + Sponsorship + + + + + + + Subscribe to newsletters for updates + + + + `, + transformCode: (code) => { + return transformedCode(code); + }, + scope: { + Wrapper, + FormControl, + FormControlLabel, + FormControlLabelText, + FormControlHelper, + FormControlHelperText, + FormControlError, + FormControlErrorIcon, + FormControlErrorText, + Icon, + Checkbox, + CheckboxGroup, + CheckboxIndicator, + CheckboxIcon, + CheckboxLabel, + AlertCircleIcon, + VStack, + CheckIcon, + Heading, + }, + argsType: {}, + }} + /> + + +#### Form Control with Textarea + +The Textarea Component can be incorporated within the FormControl. + + + + + + Comment + + + + + + Type your comment above + + + + `, + transformCode: (code) => { + return transformedCode(code); + }, + scope: { + Wrapper, + FormControl, + FormControlLabel, + FormControlLabelText, + FormControlHelper, + FormControlHelperText, + FormControlError, + FormControlErrorIcon, + FormControlErrorText, + Icon, + Textarea, + TextareaInput, + AlertCircleIcon, + }, + argsType: {}, + }} + /> + + +#### Form Control with Inline Form + +Inline forms can utilize FormControl for seamless integration and enhanced functionality. + + + + + + + + + + + + + + + + `, + transformCode: (code) => { + return transformedCode(code); + }, + scope: { + Wrapper, + FormControl, + FormControlLabel, + FormControlLabelText, + FormControlHelper, + FormControlHelperText, + FormControlError, + FormControlErrorIcon, + FormControlErrorText, + Icon, + HStack, + ChevronDownIcon, + Input, + InputField, + Select, + SelectTrigger, + SelectInput, + SelectIcon, + SelectPortal, + SelectBackdrop, + SelectContent, + SelectDragIndicatorWrapper, + SelectDragIndicator, + SelectItem, + Button, + ButtonText, + }, + argsType: {}, + }} + /> + + +#### Form Control with Form in Modal + +Modal or other Overlay components can utilize FormControl for state management and error control. + + + + + { + setShowModal(false) + }} + className='bg-white' + > + + + + + + Change Settings + + + Make modifications to the settings with ease. + + + + + + + Name + + + + + + + + + + Email + + + + + + + + + + Volume + + + + + + + + + + + + + + Dark Mode + + + + + + + + + + ); + } + `, + transformCode: (code) => { + return transformedCode(code, 'function', 'App'); + }, + scope: { + Wrapper, + useState, + Box, + Center, + FormControl, + FormControlLabel, + FormControlLabelText, + FormControlHelper, + FormControlHelperText, + FormControlError, + FormControlErrorIcon, + FormControlErrorText, + Input, + InputField, + Button, + ButtonText, + Slider, + SliderTrack, + SliderFilledTrack, + SliderThumb, + Switch, + Modal, + ModalBackdrop, + ModalContent, + ModalHeader, + ModalCloseButton, + ModalBody, + ModalFooter, + Text: FormControlText, + Heading, + VStack, + HStack, + }, + argsType: {}, + }} + /> + + +#### Form Control with Error + +Error messages can be displayed using FormControl. + + + + + + Which time slot works best for you? + + + + + + + + + + + + Monday + + + + + + + + + + Tuesday + + + + + + + + + + Wednesday + + + + + + + + Choose one time slot for the meeting + + + + `, + transformCode: (code) => { + return transformedCode(code); + }, + scope: { + Wrapper, + FormControl, + FormControlLabel, + FormControlLabelText, + FormControlHelper, + FormControlHelperText, + FormControlError, + FormControlErrorIcon, + FormControlErrorText, + Icon, + Radio, + RadioGroup, + RadioIcon, + RadioIndicator, + RadioLabel, + AlertCircleIcon, + VStack, + CircleIcon, + Heading, + }, + argsType: {}, + }} + /> + + +#### Form Control with Form Actions + +Form Action Buttons can also be utilized in conjunction with FormControl. + + + + + + + + + + + `, + transformCode: (code) => { + return transformedCode(code); + }, + scope: { + Wrapper, + FormControl, + FormControlLabel, + FormControlLabelText, + FormControlHelper, + FormControlHelperText, + FormControlError, + FormControlErrorIcon, + FormControlErrorText, + HStack, + Button, + ButtonText, + }, + argsType: {}, + }} + /> + diff --git a/example/storybook-nativewind/src/components/FormControl/index.nw.storiesold.mdx b/example/storybook-nativewind/src/components/FormControl/index.nw.storiesold.mdx new file mode 100644 index 0000000000..4787295fc9 --- /dev/null +++ b/example/storybook-nativewind/src/components/FormControl/index.nw.storiesold.mdx @@ -0,0 +1,391 @@ +--- +title: FormControl | gluestack-ui | Installation, Usage, and API + +description: By using FormControl, developers can provide important context to form elements. This context can include whether the element is invalid, disabled, or required. + +pageTitle: FormControl + +pageDescription: By using FormControl, developers can provide important context to form elements. This context can include whether the element is invalid, disabled, or required. + +showHeader: true +--- + +import { Meta } from '@storybook/addon-docs'; + + + +import { + Icon, + AlertCircleIcon, + CircleIcon, + CheckIcon, +} from '@gluestack-ui/themed'; +import { + FormControl, + FormControlLabel, + FormControlLabelText, + FormControlHelper, + FormControlHelperText, + FormControlError, + FormControlErrorIcon, + FormControlErrorText, + Input, + InputField, +} from './FormControl'; +import { Center, Text as FormControlText, Heading } from '@gluestack-ui/themed'; +import { + ChevronDownIcon, + Button, + ButtonText, + Radio, + RadioGroup, + RadioIcon, + RadioIndicator, + RadioLabel, + Checkbox, + CheckboxGroup, + CheckboxIndicator, + CheckboxIcon, + CheckboxLabel, +} from '@gluestack-ui/themed'; +import { + Textarea, + TextareaInput, + Select, + SelectTrigger, + SelectInput, + SelectIcon, + SelectPortal, + SelectBackdrop, + SelectContent, + SelectDragIndicatorWrapper, + SelectDragIndicator, + SelectItem, + Switch, +} from '@gluestack-ui/themed'; +import { + Slider, + SliderTrack, + SliderFilledTrack, + SliderThumb, + Modal, + ModalBackdrop, + ModalContent, + ModalHeader, + ModalCloseButton, + ModalBody, + ModalFooter, + HStack, + VStack, +} from '@gluestack-ui/themed'; +import { transformedCode } from '../../utils'; +import { + AppProvider, + CodePreview, + Table, + TableContainer, + Text, + InlineCode, +} from '@gluestack/design-system'; + +import { useState } from 'react'; + +import Wrapper from '../../core-components/nativewind/Wrapper'; +import { Box } from '../../core-components/nativewind/box'; +import { CollapsibleCode } from '@gluestack/design-system'; + +This is an illustration of **FormControl** component. + + + + + + Password + + + + + + + Must be at least 6 characters. + + + + + + At least 6 characters are required. + + + + + `, + transformCode: (code) => { + return transformedCode(code); + }, + scope: { + Wrapper, + FormControl, + FormControlLabel, + FormControlLabelText, + FormControlHelper, + FormControlHelperText, + FormControlError, + FormControlErrorIcon, + FormControlErrorText, + Icon, + Input, + InputField, + AlertCircleIcon, + Box, + }, + argsType: { + size: { + control: 'select', + options: ['sm', 'md', 'lg'], + default: 'md', + }, + isDisabled: { + control: 'boolean', + default: false, + }, + isInvalid: { + control: 'boolean', + default: false, + }, + isReadOnly: { + control: 'boolean', + default: false, + }, + isRequired: { + control: 'boolean', + default: false, + }, + }, + }} + /> + + +
+ +## Installation + +### Step 1: Install the following dependencies: + +```bash + +npm i @gluestack-ui/form-control + +``` + +### Step 2: Copy and paste the following code into your project. + + + +```jsx %%-- File: core-components/nativewind/form-control/index.tsx --%% +``` + + + +### Step 3: Update the import paths to match your project setup. + +## API Reference + +To use this component in your project, include the following import statement in your file. + +```bash +import { FormControl } from '@/components/ui/form-control'; +``` + +```jsx +export default () => ( + + + + + + + + + + + + +); +``` + +### Component Props + +This section provides a comprehensive reference list for the component props, detailing descriptions, properties, types, and default behavior for easy project integration. + +#### FormControl + +It inherits all the properties of React Native's [View](https://reactnative.dev/docs/view) component. + + + + + + + + Prop + + + Type + + + Default + + + Description + + + + + + + + isInvalid + + + + bool + + + false + + + {`When true, invalid state.`} + + + + + + isRequired + + + + bool + + + false + + + {`If true, astrick gets activated.`} + + + + + + isDisabled + + + + bool + + + false + + + {`Disabled state true.`} + + + + + + isReadOnly + + + + bool + + + false + + + {`To manually set read-only state.`} + + + + + + isDisabled + + + + bool + + + false + + + {`To manually set disable to the FormControl.`} + + + +
+
+
+ +#### FormControlLabel + +It inherits all the properties of React Native's [View](https://reactnative.dev/docs/view) component. + +#### FormControlLabelText + +It inherits all the properties of React Native's [Text](https://reactnative.dev/docs/text) component. + +#### FormControlHelper + +It inherits all the properties of React Native's [View](https://reactnative.dev/docs/view) component. + +#### FormControlHelperText + +It inherits all the properties of React Native's [Text](https://reactnative.dev/docs/text) component. + +#### FormControlError + +It inherits all the properties of React Native's [View](https://reactnative.dev/docs/view) component. + +#### FormControlErrorIcon + +It inherits all the properties of gluestack Style's [AsForwarder](/style/docs/api/as-forwarder) component. + +#### FormControlErrorText + +It inherits all the properties of React Native's [Text](https://reactnative.dev/docs/text) component. + +### Features + +- Keyboard support for actions. +- Support for hover, focus and active states. +- Option to add your styles or use the default styles. + +### Props + +FormControl component is created using View component from react-native. It extends all the props supported by [React Native View](https://reactnative.dev/docs/view#props). + + diff --git a/example/storybook-nativewind/src/components/FormControl/index.themed.stories.mdx b/example/storybook-nativewind/src/components/FormControl/index.themed.stories.mdx index 343460624f..c7a77ac500 100644 --- a/example/storybook-nativewind/src/components/FormControl/index.themed.stories.mdx +++ b/example/storybook-nativewind/src/components/FormControl/index.themed.stories.mdx @@ -72,7 +72,7 @@ import { Icon, Button, ButtonText, -} from './FormControl'; +} from '../../core-components/themed'; import { AppProvider, CodePreview, @@ -84,7 +84,7 @@ import { } from '@gluestack/design-system'; import { transformedCode } from '../../utils'; import { useState } from 'react'; -import Wrapper from '../../components-example/themed/Wrapper'; +import Wrapper from '../../core-components/themed/Wrapper'; This is an illustration of **FormControl** component. @@ -183,7 +183,11 @@ npm i @gluestack-ui/form-control ### Step 2: Copy and paste the following code into your project. - ```jsx %%-- File: components-example/themed/FormControl/index.tsx --%% ``` + +```jsx +%%-- File: core-components/themed/form-control/index.tsx --%% +``` + ### Step 3: Update the import paths to match your project setup. @@ -193,7 +197,7 @@ npm i @gluestack-ui/form-control To use this component in your project, include the following import statement in your file. ```jsx -import { FormControl } from '@/components/ui/FormControl'; +import { FormControl } from '@/components/ui/form-control'; ``` ```jsx diff --git a/example/storybook-nativewind/src/components/HStack/HStack.tsx b/example/storybook-nativewind/src/components/HStack/HStack.tsx index 141648d1f9..51764f6b38 100644 --- a/example/storybook-nativewind/src/components/HStack/HStack.tsx +++ b/example/storybook-nativewind/src/components/HStack/HStack.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { HStack } from '@/components/ui/HStack'; +import { HStack } from '@/components/ui/hstack'; import { Box } from '@gluestack-ui/themed'; const HStackBasic = ({ space, reversed, ...props }: any) => { diff --git a/example/storybook-nativewind/src/components/HStack/index.nw.stories.mdx b/example/storybook-nativewind/src/components/HStack/index.nw.stories.mdx index e068372fa6..6c663710bd 100644 --- a/example/storybook-nativewind/src/components/HStack/index.nw.stories.mdx +++ b/example/storybook-nativewind/src/components/HStack/index.nw.stories.mdx @@ -14,7 +14,7 @@ import { Meta } from '@storybook/addon-docs'; -import { HStack } from './HStack'; +import { HStack } from '../../core-components/nativewind'; import { transformedCode } from '../../utils'; import { AppProvider, @@ -25,9 +25,9 @@ import { InlineCode, } from '@gluestack/design-system'; -import Wrapper from '../../components-example/nativewind/Wrapper'; +import Wrapper from '../../core-components/nativewind/Wrapper'; import { CollapsibleCode } from '@gluestack/design-system'; -import { Box } from '../../components-example/nativewind/Box'; +import { Box } from '../../core-components/nativewind/box'; This is an illustration of **HStack** component. @@ -70,7 +70,11 @@ This is an illustration of **HStack** component. ### Step 1: Copy and paste the following code into your project. - ```jsx %%-- File: components-example/nativewind/HStack/index.tsx --%% ``` + +```jsx +%%-- File: core-components/nativewind/hstack/index.tsx --%% +``` + ### Step 2: Update the import paths to match your project setup. @@ -80,7 +84,7 @@ This is an illustration of **HStack** component. To use this component in your project, include the following import statement in your file. ```jsx -import { HStack } from '@/components/ui/HStack'; +import { HStack } from '@/components/ui/hstack'; ``` ```jsx diff --git a/example/storybook-nativewind/src/components/HStack/index.themed.stories.mdx b/example/storybook-nativewind/src/components/HStack/index.themed.stories.mdx index dd7296ae54..07b79ce754 100644 --- a/example/storybook-nativewind/src/components/HStack/index.themed.stories.mdx +++ b/example/storybook-nativewind/src/components/HStack/index.themed.stories.mdx @@ -14,7 +14,7 @@ import { Meta } from '@storybook/addon-docs'; -import { HStack } from './HStack'; +import { HStack } from '../../core-components/themed'; import { Box } from '@gluestack-ui/themed'; import { transformedCode } from '../../utils'; import { @@ -26,7 +26,7 @@ import { InlineCode, } from '@gluestack/design-system'; -import Wrapper from '../../components-example/themed/Wrapper'; +import Wrapper from '../../core-components/themed/Wrapper'; import { CollapsibleCode } from '@gluestack/design-system'; This is an illustration of **HStack** component. @@ -70,7 +70,11 @@ This is an illustration of **HStack** component. ### Step 1: Copy and paste the following code into your project. - ```jsx %%-- File: components-example/themed/HStack/index.tsx --%% ``` + +```jsx +%%-- File: core-components/themed/hstack/index.tsx --%% +``` + ### Step 2: Update the import paths to match your project setup. @@ -80,7 +84,7 @@ This is an illustration of **HStack** component. To use this component in your project, include the following import statement in your file. ```jsx -import { HStack } from '@/components/ui/HStack'; +import { HStack } from '@/components/ui/hstack'; ``` ```jsx diff --git a/example/storybook-nativewind/src/components/Heading/Heading.tsx b/example/storybook-nativewind/src/components/Heading/Heading.tsx index 40d3b52af9..01990b147f 100644 --- a/example/storybook-nativewind/src/components/Heading/Heading.tsx +++ b/example/storybook-nativewind/src/components/Heading/Heading.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { Center } from '@gluestack-ui/themed'; -import { Heading } from '@/components/ui/Heading'; +import { Heading } from '@/components/ui/heading'; const HeadingBasic = ({ text = "I'm the heading", ...props }) => { return {text}; diff --git a/example/storybook-nativewind/src/components/Heading/index.nw.stories.mdx b/example/storybook-nativewind/src/components/Heading/index.nw.stories.mdx index bd36d41190..81a32933a7 100644 --- a/example/storybook-nativewind/src/components/Heading/index.nw.stories.mdx +++ b/example/storybook-nativewind/src/components/Heading/index.nw.stories.mdx @@ -1,5 +1,5 @@ --- -title: Heading | gluestack-ui | Installation, Usage, and API +title: gluestack-ui Heading Component | Installation, Usage, and API description: Heading component gives you the ability to create headings for your page with different sizes and semantics from h1 to h6. @@ -14,8 +14,7 @@ import { Meta } from '@storybook/addon-docs'; -import { Heading } from './Heading'; -import { Center } from '@gluestack-ui/themed'; +import { Heading, Center } from '../../core-components/nativewind'; import { transformedCode } from '../../utils'; import { AppProvider, @@ -26,32 +25,33 @@ import { InlineCode, } from '@gluestack/design-system'; -import Wrapper from '../../components-example/nativewind/Wrapper'; +import Wrapper from '../../core-components/nativewind/Wrapper'; import { CollapsibleCode } from '@gluestack/design-system'; This is an illustration of **Heading** component. I am a Heading `, transformCode: (code) => { return transformedCode(code); }, - scope: { - Wrapper, + scope: { + Wrapper, Heading, }, - argsType: {}, - }} - /> + argsType: { }, + } +} +/> -
+
## Installation @@ -66,9 +66,11 @@ npm i @expo/html-elements ### Step 2: Copy and paste the following code into your project. - ```jsx - %%-- File: components-example/nativewind/Heading/index.tsx --%% - ``` + +```jsx +%%-- File: core-components/nativewind/heading/index.tsx --%% +``` + ### Step 3: Update the import paths to match your project setup. @@ -78,7 +80,7 @@ npm i @expo/html-elements To use this component in your project, include the following import statement in your file. ```jsx -import { Heading } from '@/components/ui/Heading'; +import { Heading } from '@/components/ui/heading'; ``` ```jsx @@ -226,3 +228,48 @@ Heading component is created using H1 component from @expo/html-elements. It ext + +### Examples + +The Examples section provides visual representations of the different variants of the component, allowing you to quickly and easily determine which one best fits your needs. Simply copy the code and integrate it into your project. + +#### Heading Sizes + +Heading component offers a range of sizes, including `xs`, `sm`, `md`, `lg`, `xl`, `2xl`, `3xl`, `4xl`, and `5xl`, allowing users to customize the size of the heading according to their design requirements. + + + + {sizes.map((size) => ( + {size} + ))} + + ); + }; + `, + transformCode: (code) => { + return transformedCode(code, 'function', 'App'); + }, + scope: { Wrapper, Center, Heading }, + argsType: {}, + }} + /> + \ No newline at end of file diff --git a/example/storybook-nativewind/src/components/Heading/index.themed.stories.mdx b/example/storybook-nativewind/src/components/Heading/index.themed.stories.mdx index 513d3f1f6d..cd9187d4eb 100644 --- a/example/storybook-nativewind/src/components/Heading/index.themed.stories.mdx +++ b/example/storybook-nativewind/src/components/Heading/index.themed.stories.mdx @@ -14,7 +14,7 @@ import { Meta } from '@storybook/addon-docs'; -import { Heading, Center } from '../../components-example/themed'; +import { Heading, Center } from '../../core-components/themed'; import { transformedCode } from '../../utils'; import { AppProvider, @@ -25,7 +25,7 @@ import { InlineCode, CollapsibleCode, } from '@gluestack/design-system'; -import Wrapper from '../../components-example/themed/Wrapper'; +import Wrapper from '../../core-components/themed/Wrapper'; This is an illustration of **Heading** component. @@ -64,7 +64,11 @@ npm i @expo/html-elements ### Step 2: Copy and paste the following code into your project. - ```jsx %%-- File: components-example/themed/Heading/index.tsx --%% ``` + +```jsx +%%-- File: core-components/themed/heading/index.tsx --%% +``` + ### Step 3: Update the import paths to match your project setup. @@ -74,7 +78,7 @@ npm i @expo/html-elements To use this component in your project, include the following import statement in your file. ```jsx -import { Heading } from '@/components/ui/Heading'; +import { Heading } from '@/components/ui/heading'; ``` ```jsx diff --git a/example/storybook-nativewind/src/components/Icon/Icon.tsx b/example/storybook-nativewind/src/components/Icon/Icon.tsx index 78c1e8a962..2d7fbfd710 100644 --- a/example/storybook-nativewind/src/components/Icon/Icon.tsx +++ b/example/storybook-nativewind/src/components/Icon/Icon.tsx @@ -57,9 +57,9 @@ import { TrashIcon, UnlockIcon, createIcon, -} from '@/components/ui/Icon'; -import { HStack } from '@/components/ui/HStack'; -import { VStack } from '@/components/ui/VStack'; +} from '@/components/ui/icon'; +import { HStack } from '@/components/ui/hstack'; +import { VStack } from '@/components/ui/vstack'; import { ChromeIcon, diff --git a/example/storybook-nativewind/src/components/Icon/index.nw.stories.mdx b/example/storybook-nativewind/src/components/Icon/index.nw.stories.mdx index 6731ef0bb8..3e61748b5a 100644 --- a/example/storybook-nativewind/src/components/Icon/index.nw.stories.mdx +++ b/example/storybook-nativewind/src/components/Icon/index.nw.stories.mdx @@ -78,10 +78,10 @@ import { FacebookIcon, createIcon, Camera, -} from './Icon'; +} from '../../core-components/nativewind'; import { Path, Rect } from 'react-native-svg'; - +import { CollapsibleCode } from "@gluestack/design-system" import { transformedCode } from '../../utils'; import { AppProvider, @@ -91,7 +91,7 @@ import { InlineCode, } from '@gluestack/design-system'; -import Wrapper from '../../components-example/nativewind/Wrapper'; +import Wrapper from '../../core-components/nativewind/Wrapper'; This is an illustration of **Icon** component. @@ -137,7 +137,11 @@ npm i @gluestack-ui/icon ### Step 2: Copy and paste the following code into your project. - ```jsx %%-- File: components-example/nativewind/Icon/index.tsx --%% ``` + +```jsx +%%-- File: core-components/nativewind/icon/index.tsx --%% +``` + ### Step 3: Update the import paths to match your project setup. @@ -147,7 +151,7 @@ npm i @gluestack-ui/icon To use this component in your project, include the following import statement in your file. ```jsx -import { Icon } from '@/components/ui/Icon'; +import { Icon } from '@/components/ui/icon'; ``` ```jsx diff --git a/example/storybook-nativewind/src/components/Icon/index.themed.stories.mdx b/example/storybook-nativewind/src/components/Icon/index.themed.stories.mdx index f1592394af..973ac160c1 100644 --- a/example/storybook-nativewind/src/components/Icon/index.themed.stories.mdx +++ b/example/storybook-nativewind/src/components/Icon/index.themed.stories.mdx @@ -78,8 +78,8 @@ import { FacebookIcon, createIcon, Camera, -} from './Icon'; - +} from '../../core-components/themed'; +import { CollapsibleCode } from "@gluestack/design-system"; import { Path, Rect } from 'react-native-svg'; import { transformedCode } from '../../utils'; @@ -91,7 +91,7 @@ import { InlineCode, } from '@gluestack/design-system'; -import Wrapper from '../../components-example/themed/Wrapper'; +import Wrapper from '../../core-components/themed/Wrapper'; This is an illustration of **Icon** component. @@ -137,7 +137,11 @@ npm i @gluestack-ui/icon ### Step 2: Copy and paste the following code into your project. - ```jsx %%-- File: components-example/themed/Icon/index.tsx --%% ``` + +```jsx +%%-- File: core-components/themed/icon/index.tsx --%% +``` + ### Step 3: Update the import paths to match your project setup. @@ -147,7 +151,7 @@ npm i @gluestack-ui/icon To use this component in your project, include the following import statement in your file. ```jsx -import { Icon } from '@/components/ui/Icon'; +import { Icon } from '@/components/ui/icon'; ``` ```jsx diff --git a/example/storybook-nativewind/src/components/Image/Image.tsx b/example/storybook-nativewind/src/components/Image/Image.tsx index 84710c12de..737dab98c2 100644 --- a/example/storybook-nativewind/src/components/Image/Image.tsx +++ b/example/storybook-nativewind/src/components/Image/Image.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { Image } from '@/components/ui/Image'; +import { Image } from '@/components/ui/image'; const ImageBasic = ({ uri = 'https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__480.jpg', diff --git a/example/storybook-nativewind/src/components/Image/ImageSizes.tsx b/example/storybook-nativewind/src/components/Image/ImageSizes.tsx index fff6b72be0..9baaaff5cd 100644 --- a/example/storybook-nativewind/src/components/Image/ImageSizes.tsx +++ b/example/storybook-nativewind/src/components/Image/ImageSizes.tsx @@ -1,4 +1,4 @@ -import { Image } from '@/components/ui/Image'; +import { Image } from '@/components/ui/image'; import { VStack } from '@gluestack-ui/themed'; import React from 'react'; diff --git a/example/storybook-nativewind/src/components/Image/index.nw.stories.mdx b/example/storybook-nativewind/src/components/Image/index.nw.stories.mdx index 25028c1268..8a7c0448b7 100644 --- a/example/storybook-nativewind/src/components/Image/index.nw.stories.mdx +++ b/example/storybook-nativewind/src/components/Image/index.nw.stories.mdx @@ -14,9 +14,9 @@ import { Meta } from '@storybook/addon-docs'; -import { Image } from './Image'; +import { Image } from '../../core-components/nativewind'; import { transformedCode } from '../../utils'; -import Wrapper from '../../components-example/nativewind/Wrapper'; +import Wrapper from '../../core-components/nativewind/Wrapper'; import { AppProvider, @@ -80,9 +80,11 @@ npm i @gluestack-ui/image ### Step 2: Copy and paste the following code into your project. - ```jsx - %%-- File: components-example/nativewind/Image/index.tsx --%% - ``` + +```jsx +%%-- File: core-components/nativewind/image/index.tsx --%% +``` + ### Step 3: Update the import paths to match your project setup. @@ -92,7 +94,7 @@ npm i @gluestack-ui/image To use this component in your project, include the following import statement in your file. ```jsx -import { Image } from '@/components/ui/Image'; +import { Image } from '@/components/ui/image'; ``` ```jsx diff --git a/example/storybook-nativewind/src/components/Image/index.themed.stories.mdx b/example/storybook-nativewind/src/components/Image/index.themed.stories.mdx index d7f586b7cf..747041d4c4 100644 --- a/example/storybook-nativewind/src/components/Image/index.themed.stories.mdx +++ b/example/storybook-nativewind/src/components/Image/index.themed.stories.mdx @@ -14,9 +14,9 @@ import { Meta } from '@storybook/addon-docs'; -import { Image } from './Image'; +import { Image } from '../../core-components/themed'; import { transformedCode } from '../../utils'; -import Wrapper from '../../components-example/themed/Wrapper'; +import Wrapper from '../../core-components/themed/Wrapper'; import { AppProvider, @@ -80,7 +80,11 @@ npm i @gluestack-ui/image ### Step 2: Copy and paste the following code into your project. - ```jsx %%-- File: components-example/themed/Image/index.tsx --%% ``` + +```jsx +%%-- File: core-components/themed/image/index.tsx --%% +``` + ### Step 3: Update the import paths to match your project setup. @@ -90,7 +94,7 @@ npm i @gluestack-ui/image To use this component in your project, include the following import statement in your file. ```jsx -import { Image } from '@/components/ui/Image'; +import { Image } from '@/components/ui/image'; ``` ```jsx diff --git a/example/storybook-nativewind/src/components/Input/Input.tsx b/example/storybook-nativewind/src/components/Input/Input.tsx index 743be8c2a4..c249853522 100644 --- a/example/storybook-nativewind/src/components/Input/Input.tsx +++ b/example/storybook-nativewind/src/components/Input/Input.tsx @@ -7,10 +7,10 @@ import { Icon, FormControl, } from '@gluestack-ui/themed'; -import { Input, InputField, InputIcon, InputSlot } from '@/components/ui/Input'; -import { Center } from '@/components/ui/Center'; -import { VStack } from '@/components/ui/VStack'; -import { Text } from '@/components/ui/Text'; +import { Input, InputField, InputIcon, InputSlot } from '@/components/ui/input'; +import { Center } from '@/components/ui/center'; +import { VStack } from '@/components/ui/vstack'; +import { Text } from '@/components/ui/text'; import { EyeIcon, EyeOffIcon, SearchIcon } from 'lucide-react-native'; import { useState } from 'react'; diff --git a/example/storybook-nativewind/src/components/Input/index.nw.stories.mdx b/example/storybook-nativewind/src/components/Input/index.nw.stories.mdx index 8bee360808..53a957d6f1 100644 --- a/example/storybook-nativewind/src/components/Input/index.nw.stories.mdx +++ b/example/storybook-nativewind/src/components/Input/index.nw.stories.mdx @@ -14,8 +14,11 @@ import { Meta } from '@storybook/addon-docs'; -import { Input, InputField, InputIcon, InputSlot } from './Input'; import { + Input, + InputField, + InputIcon, + InputSlot, Button, ButtonText, VStack, @@ -23,9 +26,10 @@ import { Center, Box, FormControl, -} from '@gluestack-ui/themed'; -import { Heading, useState } from '@gluestack-ui/themed'; -import { Icon, SearchIcon, EyeIcon, EyeOffIcon } from '@gluestack-ui/themed'; + Heading, + Icon, +} from '../../core-components/nativewind'; +import { SearchIcon, EyeIcon, EyeOffIcon } from '../../core-components/nativewind'; import { transformedCode } from '../../utils'; import { AppProvider, @@ -34,9 +38,10 @@ import { TableContainer, Text, InlineCode, + CollapsibleCode } from '@gluestack/design-system'; -import Wrapper from '../../components-example/nativewind/Wrapper'; +import Wrapper from '../../core-components/nativewind/Wrapper'; This is an illustration of **Input** component. @@ -104,9 +109,11 @@ npm i @gluestack-ui/input ### Step 2: Copy and paste the following code into your project. - ```jsx - %%-- File: components-example/nativewind/Input/index.tsx --%% - ``` + +```jsx +%%-- File: core-components/nativewind/input/index.tsx --%% +``` + ### Step 3: Update the import paths to match your project setup. @@ -116,7 +123,7 @@ npm i @gluestack-ui/input To use this component in your project, include the following import statement in your file. ```jsx -import { Input } from '@/components/ui/Input'; +import { Input } from '@/components/ui/input'; ``` ```jsx @@ -484,3 +491,133 @@ Explore the comprehensive details of the Input in this document, including its i src="https://www.figma.com/embed?embed_host=share&url=https%3A%2F%2Fwww.figma.com%2Fproto%2FNcXOxqKbdnGsLQNex3H76u%2F%25C2%25A0%25F0%259F%2593%259Agluestack-UI-handbook%3Fpage-id%3D213%253A12091%26type%3Ddesign%26node-id%3D213-12092%26viewport%3D256%252C289%252C0.03%26t%3DYlY4Jjtl91JuXCZS-1%26scaling%3Dscale-down%26starting-point-node-id%3D213%253A12092%26mode%3Ddesign" allowFullScreen > + +### Examples + +The Examples section provides visual representations of the different variants of the component, allowing you to quickly and easily determine which one best fits your needs. Simply copy the code and integrate it into your project. + +#### Input type password with FormControl + +The Input component integrates with an icon and a button, providing users with a comprehensive login window inside a FormControl component. + + + { + setShowPassword((showState) => { + return !showState; + }); + }; + return ( + + + + Login + + + + Email + + + + + + + + Password + + + + + {/* EyeIcon, EyeOffIcon are both imported from 'lucide-react-native' */} + + + + + + + + ); + } + `, + transformCode: (code) => { + return transformedCode(code, 'function', 'App'); + }, + scope: { + Wrapper, + Input, + InputField, + InputIcon, + Button, + ButtonText, + VStack, + Text: GSText, + Heading, + Icon, + EyeIcon, + EyeOffIcon, + FormControl, + InputSlot, + }, + argsType: {}, + }} + /> + + +### Input with Icons + +The Input with Icons is a variation of the Input component that displays icons next to input field. It's commonly used in apps for a more visual representation of options and easier navigation. + + + + + + + + + `, + transformCode: (code) => { + return transformedCode(code); + }, + scope: { + Wrapper, + Input, + InputField, + InputIcon, + SearchIcon, + Icon, + InputSlot, + }, + argsType: {}, + }} +/> + + diff --git a/example/storybook-nativewind/src/components/Input/index.themed.stories.mdx b/example/storybook-nativewind/src/components/Input/index.themed.stories.mdx index bd5805cb7a..377e193625 100644 --- a/example/storybook-nativewind/src/components/Input/index.themed.stories.mdx +++ b/example/storybook-nativewind/src/components/Input/index.themed.stories.mdx @@ -31,7 +31,7 @@ import { SearchIcon, EyeIcon, EyeOffIcon, -} from '../../components-example/themed'; +} from '../../core-components/themed'; import { transformedCode } from '../../utils'; import { AppProvider, @@ -40,9 +40,10 @@ import { TableContainer, Text, InlineCode, + CollapsibleCode } from '@gluestack/design-system'; -import Wrapper from '../../components-example/themed/Wrapper'; +import Wrapper from '../../core-components/themed/Wrapper'; This is an illustration of **Input** component. @@ -110,7 +111,11 @@ npm i @gluestack-ui/input ### Step 2: Copy and paste the following code into your project. - ```jsx %%-- File: components-example/themed/Input/index.tsx --%% ``` + +```jsx +%%-- File: core-components/themed/input/index.tsx --%% +``` + ### Step 3: Update the import paths to match your project setup. @@ -120,7 +125,7 @@ npm i @gluestack-ui/input To use this component in your project, include the following import statement in your file. ```jsx -import { Input } from '@/components/ui/Input'; +import { Input } from '@/components/ui/input'; ``` ```jsx diff --git a/example/storybook-nativewind/src/components/InputAcessoryView/InputAccessoryView.tsx b/example/storybook-nativewind/src/components/InputAcessoryView/InputAccessoryView.tsx index 29551be035..ffbf3bfd27 100644 --- a/example/storybook-nativewind/src/components/InputAcessoryView/InputAccessoryView.tsx +++ b/example/storybook-nativewind/src/components/InputAcessoryView/InputAccessoryView.tsx @@ -5,7 +5,7 @@ import { Center, Input, } from '@gluestack-ui/themed'; -import { InputAccessoryView } from '@/components/ui/InputAccessoryView'; +import { InputAccessoryView } from '@/components/ui/input-accessory-view'; import { config } from '@gluestack-ui/config'; import React, { useState } from 'react'; diff --git a/example/storybook-nativewind/src/components/Link/Link.tsx b/example/storybook-nativewind/src/components/Link/Link.tsx index d9b0a16bbf..f6766910d0 100644 --- a/example/storybook-nativewind/src/components/Link/Link.tsx +++ b/example/storybook-nativewind/src/components/Link/Link.tsx @@ -1,18 +1,20 @@ import React from 'react'; - -import { Icon, HStack, Text } from '@gluestack-ui/themed'; -import { Link, LinkText } from '@/components/ui/Link'; +import { Link, LinkText } from '@/components/ui/link'; +import { Icon } from '@/components/ui/icon'; +import { HStack } from '@/components/ui/hstack'; +import { Text } from '@/components/ui/text'; import { ArrowUpRightIcon } from 'lucide-react-native'; - const LinkBasic = ({ ...props }: any) => { return ( - - - GLUESTACK - - + <> + + + GLUESTACK + + + ); }; diff --git a/example/storybook-nativewind/src/components/Link/index.nw.stories.mdx b/example/storybook-nativewind/src/components/Link/index.nw.stories.mdx index 847207f073..50d6082740 100644 --- a/example/storybook-nativewind/src/components/Link/index.nw.stories.mdx +++ b/example/storybook-nativewind/src/components/Link/index.nw.stories.mdx @@ -1,5 +1,5 @@ --- -title: Link | gluestack-ui | Installation, Usage, and API +title: gluestack-ui Link Component | Installation, Usage, and API description: With links, users can navigate seamlessly throughout a website. This component has a hyperlinked appearance for a user-friendly experience. @@ -14,9 +14,7 @@ import { Meta } from '@storybook/addon-docs'; -import { Link } from './Link'; -import { LinkText } from '../../components-example/nativewind/Link'; -import { ArrowUpRightIcon, Icon, HStack, Text } from '@gluestack-ui/themed'; +import { ArrowUpRightIcon, Icon, HStack, Text, Link, LinkText } from '../../core-components/nativewind'; import { transformedCode } from '../../utils'; import { AppProvider, @@ -26,7 +24,7 @@ import { InlineCode, } from '@gluestack/design-system'; -import Wrapper from '../../components-example/nativewind/Wrapper'; +import Wrapper from '../../core-components/nativewind/Wrapper'; import { CollapsibleCode } from '@gluestack/design-system'; This is an illustration of **Link** component. @@ -69,9 +67,11 @@ npm i @gluestack-ui/link ### Step 2: Copy and paste the following code into your project. - ```jsx - %%-- File: components-example/nativewind/Link/index.tsx --%% - ``` + +```jsx +%%-- File: core-components/nativewind/link/index.tsx --%% +``` + ### Step 3: Update the import paths to match your project setup. @@ -81,7 +81,7 @@ npm i @gluestack-ui/link To use this component in your project, include the following import statement in your file. ```jsx -import { Link } from '@/components/ui/Link'; +import { Link } from '@/components/ui/link'; ``` ```jsx @@ -229,73 +229,101 @@ We have outlined the various features that ensure the Link component is accessib Link component is created using Pressable component from react-native. It extends all the props supported by [React Native Pressable](https://reactnative.dev/docs/pressable#props). - - - - - + + + Go to + + + Pinterest + + + + +`, + transformCode: (code) => { + return transformedCode(code); + }, + scope: { Link, LinkText, Wrapper, ArrowUpRightIcon, Icon, HStack, Text }, + argsType: {}, + }} + /> + diff --git a/example/storybook-nativewind/src/components/Link/index.themed.stories.mdx b/example/storybook-nativewind/src/components/Link/index.themed.stories.mdx index 1fcd544ca9..32935907ab 100644 --- a/example/storybook-nativewind/src/components/Link/index.themed.stories.mdx +++ b/example/storybook-nativewind/src/components/Link/index.themed.stories.mdx @@ -21,7 +21,7 @@ import { Icon, HStack, Text, -} from '../../components-example/themed'; +} from '../../core-components/themed'; import { AppProvider, CodePreview, @@ -30,7 +30,7 @@ import { InlineCode, } from '@gluestack/design-system'; import { transformedCode } from '../../utils'; -import Wrapper from '../../components-example/themed/Wrapper'; +import Wrapper from '../../core-components/themed/Wrapper'; import { CollapsibleCode } from '@gluestack/design-system'; This is an illustration of **Link** component. @@ -73,7 +73,11 @@ npm i @gluestack-ui/link ### Step 2: Copy and paste the following code into your project. - ```jsx %%-- File: components-example/themed/Link/index.tsx --%% ``` + +```jsx +%%-- File: core-components/themed/link/index.tsx --%% +``` + ### Step 3: Update the import paths to match your project setup. @@ -83,7 +87,7 @@ npm i @gluestack-ui/link To use this component in your project, include the following import statement in your file. ```jsx -import { Link } from '@/components/ui/Link'; +import { Link } from '@/components/ui/link'; ``` ```jsx diff --git a/example/storybook-nativewind/src/components/Menu/Menu.tsx b/example/storybook-nativewind/src/components/Menu/Menu.tsx index d261138043..e044f7cd98 100644 --- a/example/storybook-nativewind/src/components/Menu/Menu.tsx +++ b/example/storybook-nativewind/src/components/Menu/Menu.tsx @@ -17,7 +17,7 @@ import { // MenuIcon, MenuItem, MenuItemLabel, -} from '@/components/ui/Menu'; +} from '@/components/ui/menu'; import { Icon } from '@gluestack-ui/themed'; import { PaintBucket, PuzzleIcon } from 'lucide-react-native'; diff --git a/example/storybook-nativewind/src/components/Menu/index.stories.mdx b/example/storybook-nativewind/src/components/Menu/index.stories.mdx index 2be5d96238..00a03d1897 100644 --- a/example/storybook-nativewind/src/components/Menu/index.stories.mdx +++ b/example/storybook-nativewind/src/components/Menu/index.stories.mdx @@ -16,7 +16,7 @@ import { Meta } from '@storybook/addon-docs'; -import { Menu, MenuIcon, MenuItem, MenuItemLabel } from './Menu'; +import { Menu, MenuIcon, MenuItem, MenuItemLabel } from '../../core-components/themed'; import { ThemeIcon, SettingsIcon, @@ -44,7 +44,7 @@ import { InlineCode, } from '@gluestack/design-system'; -import Wrapper from '../../components-example/themed/Wrapper'; +import Wrapper from '../../core-components/themed/Wrapper'; This is an illustration of **Menu** component. diff --git a/example/storybook-nativewind/src/components/Modal/Modal.tsx b/example/storybook-nativewind/src/components/Modal/Modal.tsx index 99f39493a2..f8920311a0 100644 --- a/example/storybook-nativewind/src/components/Modal/Modal.tsx +++ b/example/storybook-nativewind/src/components/Modal/Modal.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { Button, ButtonText } from '@/components/ui/Button'; +import { Button, ButtonText } from '@/components/ui/button'; import { Modal, ModalBackdrop, @@ -8,11 +8,11 @@ import { ModalContent, ModalFooter, ModalHeader, -} from '@/components/ui/Modal'; -import { Center } from '@/components/ui/Center'; +} from '@/components/ui/modal'; +import { Center } from '@/components/ui/center'; import { X } from 'lucide-react-native'; -import { Text } from '@/components/ui/Text'; +import { Text } from '@/components/ui/text'; const ModalBasic = (props: any) => { const [showModal, setShowModal] = React.useState(false); diff --git a/example/storybook-nativewind/src/components/Modal/index.nw.storiesold.mdx b/example/storybook-nativewind/src/components/Modal/index.nw.storiesold.mdx index b4d7ac1b95..756ec455bd 100644 --- a/example/storybook-nativewind/src/components/Modal/index.nw.storiesold.mdx +++ b/example/storybook-nativewind/src/components/Modal/index.nw.storiesold.mdx @@ -54,7 +54,7 @@ import { InlineCode, } from '@gluestack/design-system'; -import Wrapper from '../../components-example/nativewind/Wrapper'; +import Wrapper from '../../core-components/nativewind/Wrapper'; import { CollapsibleCode } from '@gluestack/design-system'; This is an illustration of **Modal** component. @@ -163,9 +163,11 @@ npm i @gluestack-ui/modal ### Step 2: Copy and paste the following code into your project. - ```jsx - %%-- File: components-example/nativewind/Modal/index.tsx --%% - ``` + +```jsx +%%-- File: core-components/nativewind/modal/index.tsx --%% +``` + ### Step 3: Update the import paths to match your project setup. @@ -175,7 +177,7 @@ npm i @gluestack-ui/modal To use this component in your project, include the following import statement in your file. ```jsx -import { Modal } from '@/components/ui/Modal'; +import { Modal } from '@/components/ui/modal'; ``` ```jsx diff --git a/example/storybook-nativewind/src/components/Modal/index.themed.stories.mdx b/example/storybook-nativewind/src/components/Modal/index.themed.stories.mdx index 1be3111bdc..9303430914 100644 --- a/example/storybook-nativewind/src/components/Modal/index.themed.stories.mdx +++ b/example/storybook-nativewind/src/components/Modal/index.themed.stories.mdx @@ -24,7 +24,7 @@ import { Text as ModalText, Center, CheckCircleIcon, -} from '@gluestack-ui/themed'; +} from '../../core-components/themed'; import { Modal, ModalBackdrop, @@ -33,7 +33,7 @@ import { ModalCloseButton, ModalBody, ModalFooter, -} from './Modal'; +} from '../../core-components/themed'; import { VStack, HStack, @@ -54,7 +54,7 @@ import { InlineCode, } from '@gluestack/design-system'; -import Wrapper from '../../components-example/themed/Wrapper'; +import Wrapper from '../../core-components/themed/Wrapper'; import { CollapsibleCode } from '@gluestack/design-system'; This is an illustration of **Modal** component. @@ -164,7 +164,11 @@ npm i @gluestack-ui/modal ### Step 2: Copy and paste the following code into your project. - ```jsx %%-- File: components-example/themed/Modal/index.tsx --%% ``` + +```jsx +%%-- File: core-components/themed/modal/index.tsx --%% +``` + ### Step 3: Update the import paths to match your project setup. @@ -174,7 +178,7 @@ npm i @gluestack-ui/modal To use this component in your project, include the following import statement in your file. ```jsx -import { Modal } from '@/components/ui/Modal'; +import { Modal } from '@/components/ui/modal'; ``` ```jsx diff --git a/example/storybook-nativewind/src/components/Popover/Popover.tsx b/example/storybook-nativewind/src/components/Popover/Popover.tsx index 067c76abb0..3ca895f647 100644 --- a/example/storybook-nativewind/src/components/Popover/Popover.tsx +++ b/example/storybook-nativewind/src/components/Popover/Popover.tsx @@ -26,7 +26,7 @@ import { PopoverBody, PopoverFooter, PopoverCloseButton, -} from '@/components/ui/Popover'; +} from '@/components/ui/popover'; import { PhoneIcon, Clock3Icon, MailIcon } from 'lucide-react-native'; diff --git a/example/storybook-nativewind/src/components/Popover/index.nw.storiesold.mdx b/example/storybook-nativewind/src/components/Popover/index.nw.storiesold.mdx index c0595fd237..208332c8e8 100644 --- a/example/storybook-nativewind/src/components/Popover/index.nw.storiesold.mdx +++ b/example/storybook-nativewind/src/components/Popover/index.nw.storiesold.mdx @@ -54,7 +54,7 @@ import { InlineCode, } from '@gluestack/design-system'; -import Wrapper from '../../components-example/nativewind/Wrapper'; +import Wrapper from '../../core-components/nativewind/Wrapper'; import { CollapsibleCode } from '@gluestack/design-system'; This is an illustration of **Popover** component. @@ -306,9 +306,11 @@ npm i @gluestack-ui/popover ### Step 2: Copy and paste the following code into your project. - ```jsx -%%-- File: components-example/nativewind/Popover/index.tsx --%% + +```jsx +%%-- File: core-components/nativewind/popover/index.tsx --%% ``` + ### Step 3: Update the import paths to match your project setup. diff --git a/example/storybook-nativewind/src/components/Popover/index.themed.stories.mdx b/example/storybook-nativewind/src/components/Popover/index.themed.stories.mdx index a2a19312fb..5cf5e5cf0e 100644 --- a/example/storybook-nativewind/src/components/Popover/index.themed.stories.mdx +++ b/example/storybook-nativewind/src/components/Popover/index.themed.stories.mdx @@ -41,7 +41,7 @@ import { Clock3Icon, MailIcon, Center, -} from '../../components-example/themed'; +} from '../../core-components/themed'; import { AppProvider, CodePreview, @@ -52,7 +52,7 @@ import { CollapsibleCode, } from '@gluestack/design-system'; import { transformedCode } from '../../utils'; -import Wrapper from '../../components-example/themed/Wrapper'; +import Wrapper from '../../core-components/themed/Wrapper'; This is an illustration of **Popover** component. @@ -303,7 +303,11 @@ npm i @gluestack-ui/popover ### Step 2: Copy and paste the following code into your project. - ```jsx %%-- File: components-example/themed/Popover/index.tsx --%% ``` + +```jsx +%%-- File: core-components/themed/popover/index.tsx --%% +``` + ### Step 3: Update the import paths to match your project setup. diff --git a/example/storybook-nativewind/src/components/Pressable/Pressable.tsx b/example/storybook-nativewind/src/components/Pressable/Pressable.tsx index 7750a21dc1..9e418b858e 100644 --- a/example/storybook-nativewind/src/components/Pressable/Pressable.tsx +++ b/example/storybook-nativewind/src/components/Pressable/Pressable.tsx @@ -1,24 +1,15 @@ import React from 'react'; import { Center, Text } from '@gluestack-ui/themed'; -import { Pressable } from '@/components/ui/Pressable'; +import { Pressable } from '@/components/ui/pressable'; const PressableBasic = ({ ...props }: any) => { return ( console.log('Hello')} + // onPress={() => console.log('Hello')} {...props} - sx={{ h: 100, w: 200 }} + className="p-5 bg-primary-500" > -
- PRESSABLE -
+ PRESSABLE
); }; diff --git a/example/storybook-nativewind/src/components/Pressable/index.nw.stories.mdx b/example/storybook-nativewind/src/components/Pressable/index.nw.stories.mdx index 274b960315..6f4933fae7 100644 --- a/example/storybook-nativewind/src/components/Pressable/index.nw.stories.mdx +++ b/example/storybook-nativewind/src/components/Pressable/index.nw.stories.mdx @@ -14,11 +14,12 @@ import { Meta } from '@storybook/addon-docs'; -import { Pressable, Text } from './Pressable'; +import { Pressable, Text } from '../../core-components/nativewind'; + import { transformedCode } from '../../utils'; import { AppProvider, CodePreview } from '@gluestack/design-system'; -import Wrapper from '../../components-example/nativewind/Wrapper'; +import Wrapper from '../../core-components/nativewind/Wrapper'; import { CollapsibleCode } from '@gluestack/design-system'; This is an illustration of **Pressable** component. @@ -30,7 +31,7 @@ This is an illustration of **Pressable** component. metaData={{ code: ` console.log('Hello')} className="p-5 bg-primary-500 hover:bg-primary-400"> + onPress={() => console.log('Hello')} className="p-5 bg-primary-500"> Press me `, @@ -62,7 +63,11 @@ npm i @gluestack-ui/pressable ### Step 2: Copy and paste the following code into your project. - ```jsx %%-- File: components-example/nativewind/Pressable/index.tsx --%% ``` + +```jsx +%%-- File: core-components/nativewind/pressable/index.tsx --%% +``` + ### Step 3: Update the import paths to match your project setup. @@ -72,7 +77,7 @@ npm i @gluestack-ui/pressable To use this component in your project, include the following import statement in your file. ```jsx -import { Pressable } from '@/components/ui/Pressable'; +import { Pressable } from '@/components/ui/pressable'; ``` ```jsx @@ -101,12 +106,14 @@ You can change the child elements according to the states of Pressable component showArgsController={false} metaData={{ code: ` - - {({ pressed }) => ( - PRESSABLE + + {({ pressed }) => ( + + PRESSABLE + )} - -`, + + `, transformCode: (code) => { return transformedCode(code); }, diff --git a/example/storybook-nativewind/src/components/Pressable/index.stories.mdx b/example/storybook-nativewind/src/components/Pressable/index.stories.mdx index 4aead56b36..61f03cbda8 100644 --- a/example/storybook-nativewind/src/components/Pressable/index.stories.mdx +++ b/example/storybook-nativewind/src/components/Pressable/index.stories.mdx @@ -18,7 +18,7 @@ import { Pressable } from './Pressable'; import { transformedCode } from '../../utils'; import { AppProvider, CodePreview, Text } from '@gluestack/design-system'; -import Wrapper from '../../components-example/themed/Wrapper'; +import Wrapper from '../../core-components/themed/Wrapper'; This is an illustration of **Pressable** component. diff --git a/example/storybook-nativewind/src/components/Pressable/index.themed.stories.mdx b/example/storybook-nativewind/src/components/Pressable/index.themed.stories.mdx index 20c89b1832..47005e2548 100644 --- a/example/storybook-nativewind/src/components/Pressable/index.themed.stories.mdx +++ b/example/storybook-nativewind/src/components/Pressable/index.themed.stories.mdx @@ -14,13 +14,13 @@ import { Meta } from '@storybook/addon-docs'; -import { Pressable } from './Pressable'; -import { Text } from '../../components-example/themed/Text'; +import { Pressable } from '../../core-components/themed'; +import { Text } from '../../core-components/themed'; import { transformedCode } from '../../utils'; import { AppProvider, CodePreview } from '@gluestack/design-system'; -import Wrapper from '../../components-example/themed/Wrapper'; +import Wrapper from '../../core-components/themed/Wrapper'; import { CollapsibleCode } from '@gluestack/design-system'; This is an illustration of **Pressable** component. @@ -64,7 +64,11 @@ npm i @gluestack-ui/pressable ### Step 2: Copy and paste the following code into your project. - ```jsx %%-- File: components-example/themed/Pressable/index.tsx --%% ``` + +```jsx +%%-- File: core-components/themed/pressable/index.tsx --%% +``` + ### Step 3: Update the import paths to match your project setup. @@ -74,7 +78,7 @@ npm i @gluestack-ui/pressable To use this component in your project, include the following import statement in your file. ```jsx -import { Pressable } from '@/components/ui/Pressable'; +import { Pressable } from '@/components/ui/pressable'; ``` ```jsx diff --git a/example/storybook-nativewind/src/components/Progress/Progress.tsx b/example/storybook-nativewind/src/components/Progress/Progress.tsx index dbc60519bc..ec6dd39998 100644 --- a/example/storybook-nativewind/src/components/Progress/Progress.tsx +++ b/example/storybook-nativewind/src/components/Progress/Progress.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { VStack, Text, Box, Heading, Center } from '@gluestack-ui/themed'; -import { Progress, ProgressFilledTrack } from '@/components/ui/Progress'; +import { Progress, ProgressFilledTrack } from '@/components/ui/progress'; const ProgressBasic = ({ value = 50, ...props }: any) => { return ( diff --git a/example/storybook-nativewind/src/components/Progress/index.nw.stories.mdx b/example/storybook-nativewind/src/components/Progress/index.nw.stories.mdx index 5f8497f3ec..b381a6df3f 100644 --- a/example/storybook-nativewind/src/components/Progress/index.nw.stories.mdx +++ b/example/storybook-nativewind/src/components/Progress/index.nw.stories.mdx @@ -14,12 +14,8 @@ import { Meta } from '@storybook/addon-docs'; -import { - Progress, - ProgressFilledTrack, -} from '../../components-example/nativewind/Progress'; -import { VStack, Box, Heading } from '@gluestack-ui/themed'; +import { Progress, ProgressFilledTrack, VStack, Box, Heading } from '../../core-components/nativewind'; import { transformedCode } from '../../utils'; import { AppProvider, @@ -30,7 +26,7 @@ import { InlineCode, } from '@gluestack/design-system'; -import Wrapper from '../../components-example/nativewind/Wrapper'; +import Wrapper from '../../core-components/nativewind/Wrapper'; import { CollapsibleCode } from '@gluestack/design-system'; This is an illustration of **Progress** component. @@ -75,7 +71,11 @@ npm i @gluestack-ui/progress ### Step 2: Copy and paste the following code into your project. - ```jsx %%-- File: components-example/nativewind/Progress/index.tsx --%% ``` + +```jsx +%%-- File: core-components/nativewind/progress/index.tsx --%% +``` + ### Step 3: Update the import paths to match your project setup. @@ -85,7 +85,7 @@ npm i @gluestack-ui/progress To use this component in your project, include the following import statement in your file. ```jsx -import { Progress, ProgressFilledTrack } from '@/components/ui/Progress'; +import { Progress, ProgressFilledTrack } from '@/components/ui/progress'; ``` ```jsx diff --git a/example/storybook-nativewind/src/components/Progress/index.themed.stories.mdx b/example/storybook-nativewind/src/components/Progress/index.themed.stories.mdx index b32be59ff4..940d6e5747 100644 --- a/example/storybook-nativewind/src/components/Progress/index.themed.stories.mdx +++ b/example/storybook-nativewind/src/components/Progress/index.themed.stories.mdx @@ -17,9 +17,9 @@ import { Meta } from '@storybook/addon-docs'; import { Progress, ProgressFilledTrack, -} from '../../components-example/themed/Progress'; +} from '../../core-components/themed'; -import { VStack, Box, Heading } from '@gluestack-ui/themed'; +import { VStack, Box, Heading } from '../../core-components/themed'; import { transformedCode } from '../../utils'; import { AppProvider, @@ -30,7 +30,7 @@ import { InlineCode, } from '@gluestack/design-system'; -import Wrapper from '../../components-example/themed/Wrapper'; +import Wrapper from '../../core-components/themed/Wrapper'; import { CollapsibleCode } from '@gluestack/design-system'; This is an illustration of **Progress** component. @@ -75,7 +75,11 @@ npm i @gluestack-ui/progress ### Step 2: Copy and paste the following code into your project. - ```jsx %%-- File: components-example/themed/Progress/index.tsx --%% ``` + +```jsx +%%-- File: core-components/themed/progress/index.tsx --%% +``` + ### Step 3: Update the import paths to match your project setup. @@ -85,7 +89,7 @@ npm i @gluestack-ui/progress To use this component in your project, include the following import statement in your file. ```jsx -import { Progress, ProgressFilledTrack } from '@/components/ui/Progress'; +import { Progress, ProgressFilledTrack } from '@/components/ui/progress'; ``` ```jsx diff --git a/example/storybook-nativewind/src/components/Radio/Radio.tsx b/example/storybook-nativewind/src/components/Radio/Radio.tsx index ee06740019..f1eed53d00 100644 --- a/example/storybook-nativewind/src/components/Radio/Radio.tsx +++ b/example/storybook-nativewind/src/components/Radio/Radio.tsx @@ -16,7 +16,7 @@ import { RadioIcon, RadioIndicator, RadioLabel, -} from '@/components/ui/Radio'; +} from '@/components/ui/radio'; const RadioBasic = ({ ...props }: any) => { const [values, setValues] = React.useState('Label 1'); diff --git a/example/storybook-nativewind/src/components/Radio/RadioGroup.tsx b/example/storybook-nativewind/src/components/Radio/RadioGroup.tsx index 6f2511247f..065c24c82c 100644 --- a/example/storybook-nativewind/src/components/Radio/RadioGroup.tsx +++ b/example/storybook-nativewind/src/components/Radio/RadioGroup.tsx @@ -7,7 +7,7 @@ import { RadioIcon, RadioIndicator, RadioLabel, -} from '@/components/ui/Radio'; +} from '@/components/ui/radio'; const RadioGroupBasic = ({ size, diff --git a/example/storybook-nativewind/src/components/Radio/index.nw.stories.mdx b/example/storybook-nativewind/src/components/Radio/index.nw.stories.mdx index bd52771cb7..f6965b8195 100644 --- a/example/storybook-nativewind/src/components/Radio/index.nw.stories.mdx +++ b/example/storybook-nativewind/src/components/Radio/index.nw.stories.mdx @@ -20,9 +20,9 @@ import { RadioIcon, RadioIndicator, RadioLabel, -} from './Radio'; -import { HStack, Box, Heading, CircleIcon, Center } from '@gluestack-ui/themed'; -import { VStack, Text, FormControl } from '@gluestack-ui/themed'; +} from '../../core-components/nativewind'; +import { HStack, Box, Heading, CircleIcon, Center } from '../../core-components/nativewind'; +import { VStack, Text, FormControl } from '../../core-components/nativewind'; import { useState, useRef } from 'react'; import { transformedCode } from '../../utils'; import { @@ -33,7 +33,7 @@ import { InlineCode, } from '@gluestack/design-system'; -import Wrapper from '../../components-example/nativewind/Wrapper'; +import Wrapper from '../../core-components/nativewind/Wrapper'; import { CollapsibleCode } from '@gluestack/design-system'; This is an illustration of **Radio** component. @@ -97,9 +97,10 @@ npm i @gluestack-ui/radio ### Step 2: Copy and paste the following code into your project. - ```jsx - %%-- File: components-example/nativewind/Radio/index.tsx --%% - ``` + +```jsx %%-- File: core-components/nativewind/radio/index.tsx --%% +``` + ### Step 3: Update the import paths to match your project setup. diff --git a/example/storybook-nativewind/src/components/Radio/index.themed.stories.mdx b/example/storybook-nativewind/src/components/Radio/index.themed.stories.mdx index 099ec353f2..e86b8ff52a 100644 --- a/example/storybook-nativewind/src/components/Radio/index.themed.stories.mdx +++ b/example/storybook-nativewind/src/components/Radio/index.themed.stories.mdx @@ -24,7 +24,7 @@ import { InlineCode, CollapsibleCode, } from '@gluestack/design-system'; -import Wrapper from '../../components-example/themed/Wrapper'; +import Wrapper from '../../core-components/themed/Wrapper'; import { Radio, RadioGroup, @@ -39,7 +39,7 @@ import { VStack, Text, FormControl, -} from '../../components-example/themed'; +} from '../../core-components/themed'; This is an illustration of **Radio** component. @@ -102,7 +102,11 @@ npm i @gluestack-ui/radio ### Step 2: Copy and paste the following code into your project. - ```jsx %%-- File: components-example/themed/Radio/index.tsx --%% ``` + +```jsx +%%-- File: core-components/themed/radio/index.tsx --%% +``` + ### Step 3: Update the import paths to match your project setup. diff --git a/example/storybook-nativewind/src/components/Select/Select.tsx b/example/storybook-nativewind/src/components/Select/Select.tsx index 0d9cb1d9b3..99dcc38fa5 100644 --- a/example/storybook-nativewind/src/components/Select/Select.tsx +++ b/example/storybook-nativewind/src/components/Select/Select.tsx @@ -13,7 +13,7 @@ import { SelectDragIndicatorWrapper, SelectDragIndicator, SelectItem, -} from '@/components/ui/Select'; +} from '@/components/ui/select'; const SelectBasic = ({ size = 'md', variant = 'outline', ...props }: any) => { return ( diff --git a/example/storybook-nativewind/src/components/Select/index.stories.mdx b/example/storybook-nativewind/src/components/Select/index.stories.mdx index e25668a3ae..d952004f7b 100644 --- a/example/storybook-nativewind/src/components/Select/index.stories.mdx +++ b/example/storybook-nativewind/src/components/Select/index.stories.mdx @@ -27,7 +27,7 @@ import { SelectDragIndicatorWrapper, SelectDragIndicator, SelectItem, -} from './Select'; +} from '../../core-components/themed'; import { Icon, ChevronDownIcon, @@ -51,7 +51,7 @@ import { InlineCode, } from '@gluestack/design-system'; -import Wrapper from '../../components-example/themed/Wrapper'; +import Wrapper from '../../core-components/themed/Wrapper'; This is an illustration of **Select** component. diff --git a/example/storybook-nativewind/src/components/Slider/Slider.tsx b/example/storybook-nativewind/src/components/Slider/Slider.tsx index a255bdf037..0954b467ac 100644 --- a/example/storybook-nativewind/src/components/Slider/Slider.tsx +++ b/example/storybook-nativewind/src/components/Slider/Slider.tsx @@ -17,7 +17,7 @@ import { SliderTrack, SliderFilledTrack, SliderThumb, -} from '@/components/ui/Slider'; +} from '@/components/ui/slider'; import { Volume, Volume2Icon, LightbulbIcon } from 'lucide-react-native'; diff --git a/example/storybook-nativewind/src/components/Slider/index.nw.stories.mdx b/example/storybook-nativewind/src/components/Slider/index.nw.stories.mdx index 4ebacf4392..e38fb52c02 100644 --- a/example/storybook-nativewind/src/components/Slider/index.nw.stories.mdx +++ b/example/storybook-nativewind/src/components/Slider/index.nw.stories.mdx @@ -15,14 +15,14 @@ import { useRef, useEffect, useState } from 'react'; -import { Slider } from './Slider'; +import { Slider } from '../../core-components/nativewind'; import { SliderTrack, SliderFilledTrack, SliderThumb, -} from '../../components-example/nativewind/Slider'; +} from '../../core-components/nativewind'; -import { HStack, Volume2Icon, Box } from '@gluestack-ui/themed'; +import { HStack, Volume2Icon, Box } from '../../core-components/nativewind'; import { VStack, Volume, @@ -30,10 +30,8 @@ import { LightbulbIcon, Icon, Heading, - Tooltip, - TooltipContent, Button, -} from '@gluestack-ui/themed'; +} from '../../core-components/nativewind'; import { transformedCode } from '../../utils'; import { AppProvider, @@ -43,8 +41,8 @@ import { TableContainer, } from '@gluestack/design-system'; -import Wrapper from '../../components-example/nativewind/Wrapper'; -import { Center } from '../../components-example/nativewind/Center'; +import Wrapper from '../../core-components/nativewind/Wrapper'; +import { Center } from '../../core-components/nativewind/center'; import { CollapsibleCode } from '@gluestack/design-system'; This is an illustration of **Slider** component. @@ -112,7 +110,11 @@ npm i @gluestack-ui/slider ### Step 2: Copy and paste the following code into your project. - ```jsx %%-- File: components-example/nativewind/Slider/index.tsx --%% ``` + +```jsx +%%-- File: core-components/nativewind/slider/index.tsx --%% +``` + ### Step 3: Update the import paths to match your project setup. @@ -122,7 +124,7 @@ npm i @gluestack-ui/slider To use this component in your project, include the following import statement in your file. ```jsx -import { Slider } from '@/components/ui/Slider'; +import { Slider } from '@/components/ui/slider'; ``` ```jsx diff --git a/example/storybook-nativewind/src/components/Slider/index.themed.stories.mdx b/example/storybook-nativewind/src/components/Slider/index.themed.stories.mdx index b1f46db1c6..5cb379e261 100644 --- a/example/storybook-nativewind/src/components/Slider/index.themed.stories.mdx +++ b/example/storybook-nativewind/src/components/Slider/index.themed.stories.mdx @@ -15,13 +15,13 @@ import { useRef, useEffect, useState } from 'react'; -import { Slider } from './Slider'; +import { Slider } from '../../core-components/themed'; import { SliderTrack, SliderFilledTrack, SliderThumb, -} from '../../components-example/themed/Slider'; -import { HStack, Volume2Icon, Box, Center } from '@gluestack-ui/themed'; +} from '../../core-components/themed'; +import { HStack, Volume2Icon, Box, Center } from '../../core-components/themed'; import { VStack, Volume, @@ -32,7 +32,7 @@ import { Tooltip, TooltipContent, Button, -} from '@gluestack-ui/themed'; +} from '../../core-components/themed'; import { transformedCode } from '../../utils'; import { AppProvider, @@ -42,7 +42,7 @@ import { TableContainer, } from '@gluestack/design-system'; -import Wrapper from '../../components-example/themed/Wrapper'; +import Wrapper from '../../core-components/themed/Wrapper'; import { CollapsibleCode } from '@gluestack/design-system'; This is an illustration of **Slider** component. @@ -110,7 +110,11 @@ npm i @gluestack-ui/slider ### Step 2: Copy and paste the following code into your project. - ```jsx %%-- File: components-example/themed/Slider/index.tsx --%% ``` + +```jsx +%%-- File: core-components/themed/slider/index.tsx --%% +``` + ### Step 3: Update the import paths to match your project setup. @@ -120,7 +124,7 @@ npm i @gluestack-ui/slider To use this component in your project, include the following import statement in your file. ```jsx -import { Slider } from '@/components/ui/Slider'; +import { Slider } from '@/components/ui/slider'; ``` ```jsx diff --git a/example/storybook-nativewind/src/components/Spinner/Spinner.tsx b/example/storybook-nativewind/src/components/Spinner/Spinner.tsx index f3323df697..4baa6284d0 100644 --- a/example/storybook-nativewind/src/components/Spinner/Spinner.tsx +++ b/example/storybook-nativewind/src/components/Spinner/Spinner.tsx @@ -1,9 +1,13 @@ import React from 'react'; +import { Spinner } from '@/components/ui/spinner'; +import { HStack } from '@/components/ui/hstack'; +import { Text } from '@/components/ui/text'; +import { VStack } from '@/components/ui/vstack'; +import colors from 'tailwindcss/colors'; -import { HStack, Text, VStack } from '@gluestack-ui/themed'; -import { Spinner } from '@/components/ui/Spinner'; - -const SpinnerBasic = ({ ...props }) => ; +const SpinnerBasic = ({ ...props }) => ( + +); SpinnerBasic.description = 'This is a basic Spinner component example. Spinners are used to show a loading state of a component or page.'; diff --git a/example/storybook-nativewind/src/components/Spinner/index.nw.stories.mdx b/example/storybook-nativewind/src/components/Spinner/index.nw.stories.mdx index 97e48dc519..796220bcb9 100644 --- a/example/storybook-nativewind/src/components/Spinner/index.nw.stories.mdx +++ b/example/storybook-nativewind/src/components/Spinner/index.nw.stories.mdx @@ -14,12 +14,12 @@ import { Meta } from '@storybook/addon-docs'; -import { Spinner } from './Spinner'; -import { HStack, VStack, Text } from '@gluestack-ui/themed'; +import { Spinner, HStack, VStack, Text } from '../../core-components/nativewind'; import { transformedCode } from '../../utils'; import { AppProvider, CodePreview } from '@gluestack/design-system'; +import colors from 'tailwindcss/colors'; -import Wrapper from '../../components-example/nativewind/Wrapper'; +import Wrapper from '../../core-components/nativewind/Wrapper'; import { CollapsibleCode } from '@gluestack/design-system'; This is an illustration of **Spinner** component. @@ -62,9 +62,11 @@ npm i @gluestack-ui/spinner ### Step 2: Copy and paste the following code into your project. - ```jsx - %%-- File: components-example/nativewind/Spinner/index.tsx --%% - ``` + +```jsx +%%-- File: core-components/nativewind/spinner/index.tsx --%% +``` + ### Step 3: Update the import paths to match your project setup. @@ -74,7 +76,7 @@ npm i @gluestack-ui/spinner To use this component in your project, include the following import statement in your file. ```jsx -import { Spinner } from '@/components/ui/Spinner'; +import { Spinner } from '@/components/ui/spinner'; ``` ```jsx @@ -102,16 +104,67 @@ We have outlined the various features that ensure the Fab component is accessibl - VoiceOver: When the Spinner is focused, the screen reader will announce the loading indicator. - +A Spinner component with a label provides informative text or a label alongside the spinner, offering descriptive context and improving user understanding and interaction with the spinner element within a user interface. + + + + + Please Wait + + `, + transformCode: (code) => { + return transformedCode(code); + }, + scope: { + Wrapper, + Spinner, + HStack, + Text, + }, + argsType: {}, + }} + /> + + +#### Color Scheme + +A Spinner component with a color scheme enhances visual appeal by incorporating distinct colors, adding a touch of customization and style to the spinner element within a user interface. + + + + {/* colors is imported from 'tailwindcss/colors' */} + + + + + + `, + transformCode: (code) => { + return transformedCode(code); + }, + scope: { + Wrapper, + Spinner, + VStack, + colors, + }, + argsType: {}, + }} + /> + diff --git a/example/storybook-nativewind/src/components/Spinner/index.themed.stories.mdx b/example/storybook-nativewind/src/components/Spinner/index.themed.stories.mdx index 8537bdd2de..2c9953dcc2 100644 --- a/example/storybook-nativewind/src/components/Spinner/index.themed.stories.mdx +++ b/example/storybook-nativewind/src/components/Spinner/index.themed.stories.mdx @@ -14,12 +14,12 @@ import { Meta } from '@storybook/addon-docs'; -import { Spinner } from './Spinner'; -import { HStack, VStack, Text } from '@gluestack-ui/themed'; +import { Spinner } from '../../core-components/themed'; +import { HStack, VStack, Text } from '../../core-components/themed'; import { transformedCode } from '../../utils'; import { AppProvider, CodePreview } from '@gluestack/design-system'; -import Wrapper from '../../components-example/themed/Wrapper'; +import Wrapper from '../../core-components/themed/Wrapper'; import { CollapsibleCode } from '@gluestack/design-system'; This is an illustration of **Spinner** component. @@ -62,7 +62,11 @@ npm i @gluestack-ui/spinner ### Step 2: Copy and paste the following code into your project. - ```jsx %%-- File: components-example/themed/Spinner/index.tsx --%% ``` + +```jsx +%%-- File: core-components/themed/spinner/index.tsx --%% +``` + ### Step 3: Update the import paths to match your project setup. @@ -72,7 +76,7 @@ npm i @gluestack-ui/spinner To use this component in your project, include the following import statement in your file. ```jsx -import { Spinner } from '@/components/ui/Spinner'; +import { Spinner } from '@/components/ui/spinner'; ``` ```jsx diff --git a/example/storybook-nativewind/src/components/Switch/Switch.tsx b/example/storybook-nativewind/src/components/Switch/Switch.tsx index 46fc9f3ffd..887e642676 100644 --- a/example/storybook-nativewind/src/components/Switch/Switch.tsx +++ b/example/storybook-nativewind/src/components/Switch/Switch.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { VStack, Text, HStack } from '@gluestack-ui/themed'; -import { Switch } from '@/components/ui/Switch'; +import { Switch } from '@/components/ui/switch'; const SwitchBasic = ({ ...props }: any) => { return ; diff --git a/example/storybook-nativewind/src/components/Switch/index.nw.stories.mdx b/example/storybook-nativewind/src/components/Switch/index.nw.stories.mdx index cf75ade7e4..b8921c98df 100644 --- a/example/storybook-nativewind/src/components/Switch/index.nw.stories.mdx +++ b/example/storybook-nativewind/src/components/Switch/index.nw.stories.mdx @@ -16,9 +16,9 @@ import { Meta } from '@storybook/addon-docs'; -import { Switch } from './Switch'; -import { VStack, Text } from '@gluestack-ui/themed'; -import { HStack } from '@gluestack-ui/themed'; +import { Switch } from '../../core-components/nativewind'; +import { VStack, Text } from '../../core-components/nativewind'; +import { HStack } from '../../core-components/nativewind'; import { transformedCode } from '../../utils'; import { AppProvider, @@ -28,7 +28,7 @@ import { InlineCode, } from '@gluestack/design-system'; -import Wrapper from '../../components-example/nativewind/Wrapper'; +import Wrapper from '../../core-components/nativewind/Wrapper'; import { CollapsibleCode } from '@gluestack/design-system'; This is an illustration of **Switch** component. @@ -74,9 +74,11 @@ npm i @gluestack-ui/switch ### Step 2: Copy and paste the following code into your project. - ```jsx - %%-- File: components-example/nativewind/Switch/index.tsx --%% - ``` + +```jsx +%%-- File: core-components/nativewind/switch/index.tsx --%% +``` + ### Step 3: Update the import paths to match your project setup. @@ -86,7 +88,7 @@ npm i @gluestack-ui/switch To use this component in your project, include the following import statement in your file. ```jsx -import { Switch } from '@/components/ui/Switch'; +import { Switch } from '@/components/ui/switch'; ``` ```jsx diff --git a/example/storybook-nativewind/src/components/Switch/index.themed.stories.mdx b/example/storybook-nativewind/src/components/Switch/index.themed.stories.mdx index 367bcd69f8..64fedab797 100644 --- a/example/storybook-nativewind/src/components/Switch/index.themed.stories.mdx +++ b/example/storybook-nativewind/src/components/Switch/index.themed.stories.mdx @@ -25,8 +25,8 @@ import { CollapsibleCode, } from '@gluestack/design-system'; import { transformedCode } from '../../utils'; -import { Switch, VStack, Text, HStack } from '../../components-example/themed'; -import Wrapper from '../../components-example/themed/Wrapper'; +import { Switch, VStack, Text, HStack } from '../../core-components/themed'; +import Wrapper from '../../core-components/themed/Wrapper'; This is an illustration of **Switch** component. @@ -71,7 +71,11 @@ npm i @gluestack-ui/switch ### Step 2: Copy and paste the following code into your project. - ```jsx %%-- File: components-example/themed/Switch/index.tsx --%% ``` + +```jsx +%%-- File: core-components/themed/switch/index.tsx --%% +``` + ### Step 3: Update the import paths to match your project setup. @@ -81,7 +85,7 @@ npm i @gluestack-ui/switch To use this component in your project, include the following import statement in your file. ```jsx -import { Switch } from '@/components/ui/Switch'; +import { Switch } from '@/components/ui/switch'; ``` ```jsx diff --git a/example/storybook-nativewind/src/components/Table/index.stories.mdx b/example/storybook-nativewind/src/components/Table/index.stories.mdx index f35e582805..a767977ce8 100644 --- a/example/storybook-nativewind/src/components/Table/index.stories.mdx +++ b/example/storybook-nativewind/src/components/Table/index.stories.mdx @@ -14,7 +14,7 @@ tag: api-draft import { Meta } from '@storybook/addon-docs'; import { Table, TableContainer, InlineCode } from '@gluestack/design-system'; -import Wrapper from '../../components-example/themed/Wrapper'; +import Wrapper from '../../core-components/themed/Wrapper'; diff --git a/example/storybook-nativewind/src/components/Tabs/index.stories.mdx b/example/storybook-nativewind/src/components/Tabs/index.stories.mdx index 42bf2811ec..a4f0c18f85 100644 --- a/example/storybook-nativewind/src/components/Tabs/index.stories.mdx +++ b/example/storybook-nativewind/src/components/Tabs/index.stories.mdx @@ -14,7 +14,7 @@ tag: api-draft import { Meta } from '@storybook/addon-docs'; import { Table, TableContainer, InlineCode } from '@gluestack/design-system'; -import Wrapper from '../../components-example/themed/Wrapper'; +import Wrapper from '../../core-components/themed/Wrapper'; diff --git a/example/storybook-nativewind/src/components/Text/Text.tsx b/example/storybook-nativewind/src/components/Text/Text.tsx index 01d25b2ae2..bd63b76ed6 100644 --- a/example/storybook-nativewind/src/components/Text/Text.tsx +++ b/example/storybook-nativewind/src/components/Text/Text.tsx @@ -1,6 +1,6 @@ import React from 'react'; -import { Center } from '@gluestack-ui/themed'; -import { Text } from '@/components/ui/Text'; +import { Text } from '@/components/ui/text'; +import { Center } from '@/components/ui/center'; const TextBasic = ({ size = 'md', @@ -8,8 +8,24 @@ const TextBasic = ({ fontWeight = 'bold', ...props }: any) => { + const fontWeights = { + hairline: 'font-hairline', + thin: 'font-thin', + light: 'font-light', + normal: 'font-normal', + medium: 'font-medium', + semibold: 'font-semibold', + bold: 'font-bold', + extrabold: 'font-extrabold', + black: 'font-black', + }; + return ( - + {text} ); diff --git a/example/storybook-nativewind/src/components/Text/index.nw.stories.mdx b/example/storybook-nativewind/src/components/Text/index.nw.stories.mdx index edc6ccf6fe..58ace6d8e6 100644 --- a/example/storybook-nativewind/src/components/Text/index.nw.stories.mdx +++ b/example/storybook-nativewind/src/components/Text/index.nw.stories.mdx @@ -14,9 +14,9 @@ import { Meta } from '@storybook/addon-docs'; -import { Text } from './Text'; +import { Text, Center } from '../../core-components/nativewind'; import { transformedCode } from '../../utils'; -import Wrapper from '../../components-example/nativewind/Wrapper'; +import Wrapper from '../../core-components/nativewind/Wrapper'; import { CollapsibleCode } from '@gluestack/design-system'; import { @@ -31,10 +31,10 @@ This is an illustration of **Text** component. Hello World! @@ -42,25 +42,28 @@ This is an illustration of **Text** component. transformCode: (code) => { return transformedCode(code); }, - scope: { - Wrapper, + scope: { + Wrapper, Text, }, - argsType: {}, - }} - /> + argsType: { }, + } +} +/> -
+
## Installation ### Step 1: Copy and paste the following code into your project. - ```jsx - %%-- File: components-example/nativewind/Text/index.tsx --%% - ``` + +```jsx +%%-- File: core-components/nativewind/text/index.tsx --%% +``` + ### Step 2: Update the import paths to match your project setup. @@ -70,7 +73,7 @@ This is an illustration of **Text** component. To use this component in your project, include the following import statement in your file. ```jsx -import { Text } from '@/components/ui/Text'; +import { Text } from '@/components/ui/text'; ``` ```jsx @@ -218,3 +221,172 @@ Text component is created using Text component from react-native. It extends all + +### Examples + +The Examples section provides visual representations of the different variants of the component, allowing you to quickly and easily determine which one best fits your needs. Simply copy the code and integrate it into your project. + +#### Text Sizes + +Text component comes in different sizes, such as `xs`, `sm`, `md`, `lg`, `xl`, `2xl`, `3xl`, `4xl`, `5xl`, and `6xl` allowing users to adjust the button size based on their design needs. + + + + {sizes.map((size) => ( + {size} + ))} + + ); + }; + `, + transformCode: (code) => { + return transformedCode(code, 'function', 'App'); + }, + scope: { Wrapper, Center, Text }, + argsType: {}, + }} + /> + + +Text component also accepts some shorthands for basic quick styling. + + + + + + + + Prop + + + Type + + + Default + + + Description + + + + + + + + bold + + + + boolean + + + false + + + {`Used to make the text bold.`} + + + + + + isTruncated + + + + boolean + + + false + + + {`If true, it will render an ellipsis when the text exceeds the width of the viewport or maxWidth set.`} + + + + + + italic + + + + boolean + + + false + + + {`Used to make the text italic.`} + + + + + + underline + + + + boolean + + + false + + + {`Used underline the text.`} + + + + + + strikeThrough + + + + boolean + + + false + + + {`A horizontal line through the center of the text.`} + + + + + + highlight + + + + boolean + + + false + + + {`Used to highlight the text with a yellow background.`} + + + +
+
+
diff --git a/example/storybook-nativewind/src/components/Text/index.stories.mdx b/example/storybook-nativewind/src/components/Text/index.stories.mdx index 32dc685ec5..ce9c613837 100644 --- a/example/storybook-nativewind/src/components/Text/index.stories.mdx +++ b/example/storybook-nativewind/src/components/Text/index.stories.mdx @@ -17,7 +17,7 @@ import { Meta } from '@storybook/addon-docs'; import { Text } from './Text'; import { Center } from '@gluestack-ui/themed'; import { transformedCode } from '../../utils'; -import Wrapper from '../../components-example/themed/Wrapper'; +import Wrapper from '../../core-components/themed/Wrapper'; import { AppProvider, diff --git a/example/storybook-nativewind/src/components/Text/index.themed.stories.mdx b/example/storybook-nativewind/src/components/Text/index.themed.stories.mdx index dc6d19ac32..08b1aaf15a 100644 --- a/example/storybook-nativewind/src/components/Text/index.themed.stories.mdx +++ b/example/storybook-nativewind/src/components/Text/index.themed.stories.mdx @@ -23,8 +23,8 @@ import { CollapsibleCode, } from '@gluestack/design-system'; import { transformedCode } from '../../utils'; -import { Text, Center } from '../../components-example/themed'; -import Wrapper from '../../components-example/themed/Wrapper'; +import { Text, Center } from '../../core-components/themed'; +import Wrapper from '../../core-components/themed/Wrapper'; This is an illustration of **Text** component. @@ -57,7 +57,11 @@ This is an illustration of **Text** component. ### Step 1: Copy and paste the following code into your project. - ```jsx %%-- File: components-example/themed/Text/index.tsx --%% ``` + +```jsx +%%-- File: core-components/themed/text/index.tsx --%% +``` + ### Step 2: Update the import paths to match your project setup. @@ -67,7 +71,7 @@ This is an illustration of **Text** component. To use this component in your project, include the following import statement in your file. ```jsx -import { Text } from '@/components/ui/Text'; +import { Text } from '@/components/ui/text'; ``` ```jsx diff --git a/example/storybook-nativewind/src/components/Textarea/Textarea.tsx b/example/storybook-nativewind/src/components/Textarea/Textarea.tsx index 4fb3d21abd..e646f0dc89 100644 --- a/example/storybook-nativewind/src/components/Textarea/Textarea.tsx +++ b/example/storybook-nativewind/src/components/Textarea/Textarea.tsx @@ -8,7 +8,7 @@ import { FormControlLabelText, } from '@gluestack-ui/themed'; -import { Textarea, TextareaInput } from '@/components/ui/Textarea'; +import { Textarea, TextareaInput } from '@/components/ui/textarea'; const TextareaBasic = ({ ...props }: any) => { return ( diff --git a/example/storybook-nativewind/src/components/Textarea/index.nw.stories.mdx b/example/storybook-nativewind/src/components/Textarea/index.nw.stories.mdx index 8e88de99df..4fa3d3fda9 100644 --- a/example/storybook-nativewind/src/components/Textarea/index.nw.stories.mdx +++ b/example/storybook-nativewind/src/components/Textarea/index.nw.stories.mdx @@ -14,7 +14,6 @@ import { Meta } from '@storybook/addon-docs'; -import { Textarea, TextareaInput } from './Textarea'; import { FormControl, FormControlError, @@ -22,7 +21,9 @@ import { FormControlLabelText, FormControlHelper, FormControlHelperText, -} from '@gluestack-ui/themed'; + Textarea, + TextareaInput, +} from '../../core-components/nativewind'; import { transformedCode } from '../../utils'; import { AppProvider, @@ -31,8 +32,7 @@ import { TableContainer, InlineCode, } from '@gluestack/design-system'; - -import Wrapper from '../../components-example/nativewind/Wrapper'; +import Wrapper from '../../core-components/nativewind/Wrapper'; This is an illustration of **Textarea** component. @@ -42,7 +42,7 @@ This is an illustration of **Textarea** component. showArgsController={true} metaData={{ code: ` - + + + Start your story + + + + `, + transformCode: (code) => { + return transformedCode(code); + }, + scope: { + Wrapper, + Textarea, + TextareaInput, + FormControl, + FormControlError, + FormControlLabel, + FormControlLabelText, + FormControlHelper, + FormControlHelperText, + }, + argsType: {}, + }} + /> + + ## Spec Doc Explore the comprehensive details of the Input in this document, including its implementation details, checklist, and potential future additions. Dive into the thought process behind the component and gain insights into its development journey. @@ -367,3 +417,4 @@ Explore the comprehensive details of the Input in this document, including its i src="https://www.figma.com/embed?embed_host=share&url=https%3A%2F%2Fwww.figma.com%2Fproto%2FNcXOxqKbdnGsLQNex3H76u%2F%25C2%25A0%25F0%259F%2593%259Agluestack-UI-handbook%3Fpage-id%3D5262%253A23948%26type%3Ddesign%26node-id%3D5262-25827%26viewport%3D713%252C121%252C0.03%26t%3DKYZLJTBIKhIjLoLC-1%26scaling%3Dscale-down%26starting-point-node-id%3D5262%253A25827%26mode%3Ddesign" allowfullscreen > + diff --git a/example/storybook-nativewind/src/components/Textarea/index.stories.mdx b/example/storybook-nativewind/src/components/Textarea/index.stories.mdx index d68fcd7580..ecd303efe6 100644 --- a/example/storybook-nativewind/src/components/Textarea/index.stories.mdx +++ b/example/storybook-nativewind/src/components/Textarea/index.stories.mdx @@ -32,7 +32,7 @@ import { InlineCode, } from '@gluestack/design-system'; -import Wrapper from '../../components-example/themed/Wrapper'; +import Wrapper from '../../core-components/themed/Wrapper'; This is an illustration of **Textarea** component. diff --git a/example/storybook-nativewind/src/components/Textarea/index.themed.stories.mdx b/example/storybook-nativewind/src/components/Textarea/index.themed.stories.mdx index f0406077fa..41169bdbb1 100644 --- a/example/storybook-nativewind/src/components/Textarea/index.themed.stories.mdx +++ b/example/storybook-nativewind/src/components/Textarea/index.themed.stories.mdx @@ -23,7 +23,7 @@ import { FormControlHelperText, Textarea, TextareaInput, -} from '../../components-example/themed'; +} from '../../core-components/themed'; import { transformedCode } from '../../utils'; import { AppProvider, @@ -33,7 +33,7 @@ import { InlineCode, } from '@gluestack/design-system'; -import Wrapper from '../../components-example/themed/Wrapper'; +import Wrapper from '../../core-components/themed/Wrapper'; This is an illustration of **Textarea** component. @@ -98,7 +98,7 @@ npm i @gluestack-ui/textarea ### Step 2: Copy and paste the following code into your project. ```jsx -%%-- File: components-example/themed/Textarea/index.tsx --%% +%%-- File: core-components/themed/textarea/index.tsx --%% ``` ### Step 3: Update the import paths to match your project setup. @@ -108,7 +108,7 @@ npm i @gluestack-ui/textarea To use this component in your project, include the following import statement in your file. ```jsx -import { Textarea } from '@/components/ui/Textarea'; +import { Textarea } from '@/components/ui/textarea'; ``` ```jsx diff --git a/example/storybook-nativewind/src/components/Toast/Toast.tsx b/example/storybook-nativewind/src/components/Toast/Toast.tsx index 2bd4905b90..afe2148ee6 100644 --- a/example/storybook-nativewind/src/components/Toast/Toast.tsx +++ b/example/storybook-nativewind/src/components/Toast/Toast.tsx @@ -12,8 +12,8 @@ import { ToastTitle, ToastDescription, useToast, -} from '@/components/ui/Toast'; -import { Button, ButtonText } from '@/components/ui/Button'; +} from '@/components/ui/toast'; +import { Button, ButtonText } from '@/components/ui/button'; import { MessageCircle, AlertTriangleIcon } from 'lucide-react-native'; const ToastFigmaStory = ({ _placement = 'top', _colorMode, ...props }: any) => { diff --git a/example/storybook-nativewind/src/components/Toast/index.nw.storiesold.mdx b/example/storybook-nativewind/src/components/Toast/index.nw.storiesold.mdx index 5c9a8e8f48..b61eba94ee 100644 --- a/example/storybook-nativewind/src/components/Toast/index.nw.storiesold.mdx +++ b/example/storybook-nativewind/src/components/Toast/index.nw.storiesold.mdx @@ -43,7 +43,7 @@ import { import { View } from 'react-native'; -import Wrapper from '../../components-example/nativewind/Wrapper'; +import Wrapper from '../../core-components/nativewind/Wrapper'; import { CollapsibleCode } from '@gluestack/design-system'; This is an illustration of **Toast** component. @@ -129,9 +129,11 @@ npm i @gluestack-ui/toast ### Step 2: Copy and paste the following code into your project. - ```jsx - %%-- File: components-example/nativewind/Toast/index.tsx --%% - ``` + +```jsx +%%-- File: core-components/nativewind/toast/index.tsx --%% +``` + ### Step 3: Update the import paths to match your project setup. @@ -141,7 +143,7 @@ npm i @gluestack-ui/toast To use this component in your project, include the following import statement in your file. ```jsx -import { useToast, Toast } from '@/components/ui/Toast'; +import { useToast, Toast } from '@/components/ui/toast'; ``` ```jsx diff --git a/example/storybook-nativewind/src/components/Toast/index.themed.stories.mdx b/example/storybook-nativewind/src/components/Toast/index.themed.stories.mdx index 8248cced2b..7cba185d3a 100644 --- a/example/storybook-nativewind/src/components/Toast/index.themed.stories.mdx +++ b/example/storybook-nativewind/src/components/Toast/index.themed.stories.mdx @@ -21,7 +21,7 @@ import { useToast, Button, ButtonText, -} from './Toast'; +} from '../../core-components/themed'; import { CheckIcon, MessageCircle } from '@gluestack-ui/themed'; import { Icon, @@ -43,7 +43,7 @@ import { import { View } from 'react-native'; -import Wrapper from '../../components-example/themed/Wrapper'; +import Wrapper from '../../core-components/themed/Wrapper'; import { CollapsibleCode } from '@gluestack/design-system'; This is an illustration of **Toast** component. @@ -129,7 +129,11 @@ npm i @gluestack-ui/toast ### Step 2: Copy and paste the following code into your project. - ```jsx %%-- File: components-example/themed/Toast/index.tsx --%% ``` + +```jsx +%%-- File: core-components/themed/toast/index.tsx --%% +``` + ### Step 3: Update the import paths to match your project setup. @@ -139,7 +143,7 @@ npm i @gluestack-ui/toast To use this component in your project, include the following import statement in your file. ```jsx -import { useToast, Toast } from '@/components/ui/Toast'; +import { useToast, Toast } from '@/components/ui/toast'; ``` ```jsx diff --git a/example/storybook-nativewind/src/components/Tooltip/Tooltip.tsx b/example/storybook-nativewind/src/components/Tooltip/Tooltip.tsx index 7d1b9e6e2d..28a79ac09f 100644 --- a/example/storybook-nativewind/src/components/Tooltip/Tooltip.tsx +++ b/example/storybook-nativewind/src/components/Tooltip/Tooltip.tsx @@ -11,8 +11,8 @@ import { HStack, Icon, } from '@gluestack-ui/themed'; -import { Tooltip, TooltipContent, TooltipText } from '@/components/ui/Tooltip'; -import { Button, ButtonText } from '@/components/ui/Button'; +import { Tooltip, TooltipContent, TooltipText } from '@/components/ui/tooltip'; +import { Button, ButtonText } from '@/components/ui/button'; import { Edit, Command } from 'lucide-react-native'; const TooltipBasic = ({ diff --git a/example/storybook-nativewind/src/components/Tooltip/index.nw.storiesold.mdx b/example/storybook-nativewind/src/components/Tooltip/index.nw.storiesold.mdx index 39bdebc4f1..45b1a675d6 100644 --- a/example/storybook-nativewind/src/components/Tooltip/index.nw.storiesold.mdx +++ b/example/storybook-nativewind/src/components/Tooltip/index.nw.storiesold.mdx @@ -39,17 +39,17 @@ import { InlineCode, } from '@gluestack/design-system'; -import Wrapper from '../../components-example/nativewind/Wrapper'; +import Wrapper from '../../core-components/nativewind/Wrapper'; import { CollapsibleCode } from '@gluestack/design-system'; This is an illustration of **Tooltip** component. { @@ -68,8 +68,8 @@ This is an illustration of **Tooltip** component. transformCode: (code) => { return transformedCode(code); }, - scope: { - Wrapper, + scope: { + Wrapper, Tooltip, TooltipContent, TooltipText, @@ -77,9 +77,9 @@ This is an illustration of **Tooltip** component. Button, ButtonText, }, - argsType: { - placement: { - control: 'select', + argsType: { + placement: { + control: 'select', options: [ 'top left', 'top', @@ -96,12 +96,13 @@ This is an illustration of **Tooltip** component. ], default: 'top', }, - }, - }} - /> + }, + } +} +/> -
+
## Installation @@ -116,9 +117,11 @@ npm i @gluestack-ui/tooltip ### Step 2: Copy and paste the following code into your project. - ```jsx - %%-- File: components-example/nativewind/Tooltip/index.tsx --%% - ``` + +```jsx +%%-- File: core-components/nativewind/tooltip/index.tsx --%% +``` + ### Step 3: Update the import paths to match your project setup. @@ -128,7 +131,7 @@ npm i @gluestack-ui/tooltip To use this component in your project, include the following import statement in your file. ```jsx -import { Tooltip } from '@/components/ui/Tooltip'; +import { Tooltip } from '@/components/ui/tooltip'; ``` ```jsx @@ -224,7 +227,7 @@ It inherits all the properties of React Native's [View](https://reactnative.dev/ - {'() => void'} + { '() => void'} true @@ -240,7 +243,7 @@ It inherits all the properties of React Native's [View](https://reactnative.dev/ - {'() => void'} + { '() => void'} - @@ -256,7 +259,7 @@ It inherits all the properties of React Native's [View](https://reactnative.dev/ - {'number'} + { 'number'} 0 @@ -272,7 +275,7 @@ It inherits all the properties of React Native's [View](https://reactnative.dev/ - {'number'} + { 'number'} 0 @@ -496,11 +499,11 @@ We have outlined the various features that ensure the Tooltip component is acces Explore the comprehensive details of the Tooltip in this document, including its implementation details, checklist, and potential future additions. Dive into the thought process behind the component and gain insights into its development journey.