From 4a940ecaa0759bc55f1c13be1ea2715fe8c8f3d3 Mon Sep 17 00:00:00 2001
From: Cheton Wu <447801+cheton@users.noreply.github.com>
Date: Tue, 21 Nov 2023 14:59:12 +0800
Subject: [PATCH] docs: enhance examples by replacing code blocks with the
render function (#810)
* ci: add MDX code block extractor
* docs: update badge
* docs: update box
* docs: update checkbox-group
* docs: update checkbox
* docs: update code
* docs: update divider
* docs: remove `ControlBox` from docs
* breaking: deprecate ControlBox
* docs: update css-baseline
* docs: update flex
* docs: update grid
* docs: update image
* docs: update link
* docs: update input-base
* docs: update input-control
* docs: update input-group
* docs: update link-button
* docs: update input
* docs: update input-base
* docs: update button-base
* docs: update link
* docs: update progress
* chore: eslint warnings and errors
* docs: update search-input
* docs: update radio-group
* docs: update radio
* docs: update checkbox
* docs: update switch
* docs: update truncate
* docs: update select
* docs: update skeleton
* docs: update space
* docs: update spinner
* docs: update stack
* docs: update svg-icon
* docs: update textarea
* docs: update text
* docs: update text-label
* docs: update visually-hidden
* docs: update alert
* docs: update pagination
* docs: update tag
* docs: update menu
* docs: update theme
* docs: update lab
* docs: update getting-started and styled-system
* docs: update hooks
---
packages/react-docs/config/sidebar-routes.js | 1 -
.../pages/components/alert/alert-actions.js | 66 ++
...rt-using-the-alertclosebutton-component.js | 17 +
...lose-an-alert-using-the-isclosable-prop.js | 16 +
.../alert/customizing-the-background-color.js | 25 +
.../pages/components/alert/formatted-text.js | 41 +
.../pages/components/alert/index.page.mdx | 304 +------
.../pages/components/alert/pagination.js | 59 ++
.../pages/components/alert/severity-levels.js | 33 +
.../pages/components/alert/the-icon-prop.js | 33 +
.../components/alert/transition-effects.js | 25 +
.../pages/components/alert/variant-outline.js | 10 +
.../pages/components/alert/variant-solid.js | 10 +
.../pages/components/badge.page.mdx | 320 -------
.../pages/components/badge/badge-alignment.js | 27 +
.../components/badge/badge-visibility.js | 64 ++
.../pages/components/badge/basic.js | 50 ++
.../pages/components/badge/color.js | 34 +
.../pages/components/badge/customization.js | 62 ++
.../react-docs/pages/components/badge/dot.js | 18 +
.../pages/components/badge/index.page.mdx | 71 ++
.../react-docs/pages/components/badge/size.js | 18 +
.../pages/components/badge/standalone.js | 14 +
.../{box.page.mdx => box/index.page.mdx} | 66 +-
.../box/using-pseudo-style-props.js | 26 +
.../pages/components/box/using-style-props.js | 20 +
.../pages/components/box/using-the-as-prop.js | 10 +
.../pages/components/box/using-the-sx-prop.js | 26 +
.../{disabled.js => attribute-disabled.js} | 0
.../components/button-base/index.page.mdx | 2 +-
.../pages/components/checkbox-group.page.mdx | 194 -----
.../asynchronous-data-loading.js | 59 ++
.../pages/components/checkbox-group/colors.js | 14 +
.../controlled-checkbox-group.js | 18 +
.../checkbox-group/group-orientation.js | 14 +
.../components/checkbox-group/index.page.mdx | 60 ++
.../pages/components/checkbox-group/sizes.js | 30 +
.../pages/components/checkbox-group/states.js | 23 +
.../uncontrolled-checkbox-group.js | 14 +
.../components/checkbox/accessibility.js | 13 +
.../pages/components/checkbox/basic.js | 10 +
.../pages/components/checkbox/colors.js | 15 +
.../components/checkbox/faq-input-ref.js | 23 +
.../components/checkbox/flex-container.js | 23 +
.../components/checkbox/indeterminate.js | 36 +
.../index.page.mdx} | 133 +--
.../pages/components/checkbox/sizes.js | 18 +
.../pages/components/checkbox/states.js | 31 +
.../react-docs/pages/components/code/basic.js | 8 +
.../{code.page.mdx => code/index.page.mdx} | 4 +-
.../pages/components/control-box.page.mdx | 116 ---
.../index.page.mdx} | 0
.../pages/components/divider/basic.js | 8 +
.../pages/components/divider/composition.js | 14 +
.../divider/horizontal-orientation.js | 12 +
.../index.page.mdx} | 32 +-
.../divider/vertical-orientation.js | 12 +
.../react-docs/pages/components/flex.page.mdx | 225 -----
.../pages/components/flex/align-items.js | 31 +
.../pages/components/flex/flex-direction.js | 31 +
.../pages/components/flex/flex-none.js | 40 +
.../pages/components/flex/flex-wrap.js | 33 +
.../pages/components/flex/index.page.mdx | 67 ++
.../pages/components/flex/justify-content.js | 33 +
.../react-docs/pages/components/grid.page.mdx | 543 ------------
.../pages/components/grid/grid-area.js | 37 +
.../components/grid/grid-auto-columns.js | 38 +
.../pages/components/grid/grid-auto-flow.js | 39 +
.../pages/components/grid/grid-auto-rows.js | 39 +
.../pages/components/grid/grid-column-gap.js | 39 +
.../pages/components/grid/grid-column.js | 34 +
.../pages/components/grid/grid-gap.js | 40 +
.../pages/components/grid/grid-row-gap.js | 39 +
.../pages/components/grid/grid-row.js | 34 +
.../components/grid/grid-template-areas.js | 56 ++
.../components/grid/grid-template-columns.js | 38 +
.../components/grid/grid-template-rows.js | 39 +
.../pages/components/grid/index.page.mdx | 96 +++
.../pages/components/image/basic.js | 17 +
.../pages/components/image/index.page.mdx | 28 +
.../{image.page.mdx => image/inline-svg.js} | 43 +-
.../pages/components/input-base.page.mdx | 86 --
.../input-base/attribute-disabled.js | 11 +
.../input-base/attribute-readonly.js | 11 +
.../input-base/attribute-required.js | 18 +
.../components/input-base/attribute-type.js | 25 +
.../pages/components/input-base/basic.js | 8 +
.../components/input-base/index.page.mdx | 43 +
.../pages/components/input-control.page.mdx | 236 ------
.../components/input-control/index.page.mdx | 46 +
.../input-control/input-adornments.js | 71 ++
.../pages/components/input-control/usage.js | 146 ++++
.../pages/components/input-group.page.mdx | 291 -------
.../pages/components/input-group/basic.js | 30 +
.../components/input-group/button-add-ons.js | 72 ++
.../components/input-group/date-inputs.js | 29 +
.../components/input-group/index.page.mdx | 96 +++
.../input-group/multiple-add-ons.js | 27 +
.../components/input-group/multiple-inputs.js | 14 +
.../pages/components/input-group/sizes.js | 33 +
.../components/input-group/variant-filled.js | 21 +
.../components/input-group/variant-flush.js | 11 +
.../components/input-group/variant-outline.js | 21 +
.../input-group/variant-unstyled.js | 11 +
.../pages/components/input.page.mdx | 224 -----
.../components/input/attribute-disabled.js | 11 +
.../pages/components/input/attribute-list.js | 23 +
.../components/input/attribute-readonly.js | 11 +
.../components/input/attribute-required.js | 8 +
.../pages/components/input/attribute-type.js | 25 +
.../pages/components/input/basic.js | 12 +
.../pages/components/input/index.page.mdx | 87 ++
.../pages/components/input/sizes.js | 21 +
.../pages/components/input/validation.js | 66 ++
.../pages/components/input/variant-filled.js | 8 +
.../pages/components/input/variant-flush.js | 8 +
.../pages/components/input/variant-outline.js | 8 +
.../components/input/variant-unstyled.js | 8 +
.../pages/components/link-button/basic.js | 28 +
.../index.page.mdx} | 26 +-
.../react-docs/pages/components/link.page.mdx | 118 ---
.../pages/components/link/default.js | 12 +
.../pages/components/link/index.page.mdx | 42 +
.../components/link/link-to-another-page.js | 22 +
.../link/link-with-disabled-attribute.js | 22 +
.../pages/components/link/link-with-icon.js | 24 +
.../pages/components/link/underlined-link.js | 13 +
.../react-docs/pages/components/menu/basic.js | 29 +
.../components/menu/cascading-submenus.js | 127 +++
.../pages/components/menu/controlled.js | 64 ++
.../pages/components/menu/index.page.mdx | 789 +-----------------
.../pages/components/menu/menubutton.js | 23 +
.../pages/components/menu/menugroup.js | 52 ++
.../components/menu/menutoggle-popover.js | 44 +
.../pages/components/menu/menutoggle.js | 84 ++
.../components/menu/menutoggleicon-custom.js | 44 +
.../pages/components/menu/menutoggleicon.js | 23 +
.../pages/components/menu/placement.js | 83 ++
.../pages/components/menu/positioning.js | 23 +
.../pages/components/menu/scrolling-native.js | 51 ++
.../components/menu/scrolling-scrollbar.js | 54 ++
.../components/menu/sizing-fixed-width.js | 23 +
.../components/menu/sizing-full-width.js | 23 +
.../components/menu/sizing-max-content.js | 23 +
.../components/menu/sizing-min-content.js | 23 +
.../pages/components/menu/uncontrolled.js | 61 ++
.../pages/components/pagination/basic.js | 12 +
.../pagination/controlled-pagination.js | 18 +
.../pagination/customize-the-control-icons.js | 27 +
.../components/pagination/index.page.mdx | 159 +---
.../pagination/pagination-buttons.js | 22 +
.../pagination/pagination-ranges.js | 15 +
.../components/pagination/table-pagination.js | 98 +++
.../components/pagination/usePagination.js | 48 ++
.../pagination/usePagination.page.mdx | 46 +-
.../pages/components/progress.page.mdx | 205 -----
.../pages/components/progress/custom-color.js | 59 ++
.../pages/components/progress/index.page.mdx | 39 +
.../pages/components/progress/usage.js | 118 +++
.../pages/components/radio-group.page.mdx | 197 -----
.../radio-group/asynchronous-data-loading.js | 63 ++
.../pages/components/radio-group/colors.js | 13 +
.../radio-group/controlled-radio-group.js | 18 +
.../radio-group/group-orientation.js | 14 +
.../components/radio-group/index.page.mdx | 60 ++
.../pages/components/radio-group/sizes.js | 30 +
.../pages/components/radio-group/states.js | 23 +
.../radio-group/uncontrolled-radio-group.js | 14 +
.../pages/components/radio/accessibility.js | 12 +
.../pages/components/radio/basic.js | 10 +
.../pages/components/radio/colors.js | 15 +
.../pages/components/radio/faq-input-ref.js | 23 +
.../pages/components/radio/flex-container.js | 23 +
.../{radio.page.mdx => radio/index.page.mdx} | 93 +--
.../pages/components/radio/sizes.js | 18 +
.../pages/components/radio/states.js | 25 +
.../pages/components/search-input.page.mdx | 209 -----
.../search-input/attribute-disabled.js | 11 +
.../search-input/attribute-readonly.js | 11 +
.../search-input/attribute-required.js | 8 +
.../pages/components/search-input/basic.js | 38 +
.../components/search-input/index.page.mdx | 78 ++
.../components/search-input/keyword-search.js | 77 ++
.../pages/components/search-input/sizes.js | 12 +
.../components/search-input/variant-filled.js | 8 +
.../components/search-input/variant-flush.js | 8 +
.../search-input/variant-outline.js | 8 +
.../search-input/variant-unstyled.js | 8 +
.../pages/components/select.page.mdx | 136 ---
.../components/select/attribute-disabled.js | 10 +
.../components/select/attribute-required.js | 12 +
.../pages/components/select/basic.js | 21 +
.../pages/components/select/index.page.mdx | 71 ++
.../components/select/multiple-options.js | 25 +
.../pages/components/select/variant-filled.js | 11 +
.../components/select/variant-outline.js | 11 +
.../components/select/variant-unstyled.js | 11 +
.../pages/components/skeleton.page.mdx | 182 ----
.../pages/components/skeleton/animations.js | 55 ++
.../pages/components/skeleton/color.js | 16 +
.../pages/components/skeleton/index.page.mdx | 61 ++
.../components/skeleton/modal-skeletons.js | 44 +
.../components/skeleton/profile-skeletons.js | 27 +
.../pages/components/skeleton/variants.js | 13 +
.../pages/components/space.page.mdx | 49 --
.../components/space/horizontal-spacing.js | 18 +
.../pages/components/space/index.page.mdx | 29 +
.../components/space/vertical-spacing.js | 14 +
.../pages/components/spinner/basic.js | 8 +
.../pages/components/spinner/customization.js | 18 +
.../index.page.mdx} | 30 +-
.../pages/components/spinner/sizes.js | 14 +
.../pages/components/stack/index.page.mdx | 29 +
.../{stack.page.mdx => stack/usage.js} | 69 +-
.../pages/components/svg-icon.page.mdx | 59 --
.../pages/components/svg-icon/basic.js | 10 +
.../pages/components/svg-icon/custom-icon.js | 28 +
.../pages/components/svg-icon/index.page.mdx | 31 +
...{faq-input-element.js => faq-input-ref.js} | 7 +-
.../pages/components/switch/index.page.mdx | 2 +-
.../react-docs/pages/components/tag/basic.js | 8 +
.../tag/{input-tag.js => creating-tags.js} | 0
.../pages/components/tag/custom-colors.js | 205 +++++
.../pages/components/tag/index.page.mdx | 283 +------
.../react-docs/pages/components/tag/sizes.js | 29 +
.../react-docs/pages/components/tag/states.js | 19 +
.../tag/using-the-isclosable-prop.js | 16 +
.../tag/using-the-tagclosebutton-component.js | 17 +
.../pages/components/tag/variants.js | 11 +
.../pages/components/text-label/basic.js | 8 +
.../index.page.mdx} | 4 +-
.../react-docs/pages/components/text.page.mdx | 143 ----
.../pages/components/text/formatting-text.js | 23 +
.../pages/components/text/headings.js | 16 +
.../pages/components/text/index.page.mdx | 46 +
.../react-docs/pages/components/text/sizes.js | 33 +
.../pages/components/text/text-truncation.js | 14 +
.../pages/components/text/the-as-prop.js | 33 +
.../pages/components/textarea.page.mdx | 199 -----
.../components/textarea/attribute-disabled.js | 11 +
.../components/textarea/attribute-readonly.js | 11 +
.../components/textarea/attribute-required.js | 8 +
.../pages/components/textarea/basic.js | 12 +
.../pages/components/textarea/index.page.mdx | 78 ++
.../pages/components/textarea/sizing.js | 38 +
.../pages/components/textarea/validation.js | 68 ++
.../components/textarea/variant-filled.js | 8 +
.../components/textarea/variant-outline.js | 8 +
.../components/textarea/variant-unstyled.js | 8 +
.../pages/components/truncate.page.mdx | 147 ----
.../components/truncate/container-width.js | 12 +
.../components/truncate/expand-on-hover.js | 44 +
.../components/truncate/faq-line-clamp.js | 20 +
.../pages/components/truncate/index.page.mdx | 47 ++
.../components/truncate/overflow-tooltip.js | 38 +
.../components/truncate/truncate-width.js | 13 +
.../pages/components/visually-hidden/basic.js | 13 +
.../index.page.mdx} | 9 +-
.../pages/getting-started/.gitignore | 1 -
.../index.page.mdx} | 0
.../getting-started/css-variables.page.mdx | 68 --
.../css-variables/default-css-variables.js | 38 +
.../css-variables/index.page.mdx | 33 +
.../index.page.mdx} | 0
.../index.page.mdx} | 0
.../index.page.mdx} | 0
.../getting-started/the-sx-prop.page.mdx | 160 ----
.../the-sx-prop/array-of-callbacks.js | 21 +
.../the-sx-prop/array-of-objects.js | 31 +
.../the-sx-prop/creating-a-custom-button.js | 24 +
.../defining-css-custom-properties.js | 19 +
.../the-sx-prop/index.page.mdx | 43 +
.../the-sx-prop/passing-the-sx-prop.js | 27 +
.../the-sx-prop/using-media-queries.js | 29 +
.../{ => usage}/components/AnimatedCube.js | 0
.../{ => usage}/components/FormulaOne.js | 0
.../{ => usage}/components/Rainbow.js | 0
.../{usage.page.mdx => usage/index.page.mdx} | 31 +-
...sing-style-props-and-pseudo-style-props.js | 35 +
.../pages/getting-started/versions/.gitignore | 1 +
.../index.page.mdx.template} | 0
.../react-docs/pages/hooks/useCallback.js | 27 +
packages/react-docs/pages/hooks/useConst.js | 17 +
.../react-docs/pages/hooks/useConst.page.mdx | 14 +-
.../pages/hooks/useCopyToClipboard.js | 42 +
.../pages/hooks/useCopyToClipboard.page.mdx | 39 +-
.../react-docs/pages/hooks/useEffectOnce.js | 28 +
.../pages/hooks/useEffectOnce.page.mdx | 25 +-
.../pages/hooks/useEffectOnceWhen.js | 27 +
.../pages/hooks/useEffectOnceWhen.page.mdx | 24 +-
.../pages/hooks/useEventCallback.js | 28 +
.../pages/hooks/useEventCallback.page.mdx | 48 +-
.../pages/hooks/useEventListener.js | 37 +
.../pages/hooks/useEventListener.page.mdx | 34 +-
.../react-docs/pages/hooks/useHydrated.js | 14 +
.../pages/hooks/useHydrated.page.mdx | 12 +-
.../pages/hooks/useIsomorphicEffect.js | 17 +
.../pages/hooks/useIsomorphicEffect.page.mdx | 14 +-
.../react-docs/pages/hooks/useLatestRef.js | 40 +
.../pages/hooks/useLatestRef.page.mdx | 37 +-
.../react-docs/pages/hooks/useMediaQuery.js | 68 ++
.../pages/hooks/useMediaQuery.page.mdx | 65 +-
.../react-docs/pages/hooks/useMergeRefs.js | 34 +
.../pages/hooks/useMergeRefs.page.mdx | 30 +-
packages/react-docs/pages/hooks/useOnce.js | 26 +
.../react-docs/pages/hooks/useOnce.page.mdx | 23 +-
.../react-docs/pages/hooks/useOnceWhen.js | 26 +
.../pages/hooks/useOnceWhen.page.mdx | 23 +-
.../react-docs/pages/hooks/useOutsideClick.js | 109 +++
.../pages/hooks/useOutsideClick.page.mdx | 106 +--
.../react-docs/pages/hooks/usePrevious.js | 21 +
.../pages/hooks/usePrevious.page.mdx | 18 +-
packages/react-docs/pages/hooks/useToggle.js | 15 +
.../react-docs/pages/hooks/useToggle.page.mdx | 12 +-
.../pages/lab/date-pickers/date-pickers.js | 44 +
.../pages/lab/date-pickers/index.page.mdx | 70 +-
.../pages/lab/date-pickers/native-pickers.js | 33 +
.../react-docs/pages/styled-system/.gitignore | 2 -
.../styled-system/pseudo-style-props.page.mdx | 416 ---------
.../pseudo-style-props.page.mdx.template | 379 ---------
.../pseudo-style-props/.gitignore | 1 +
.../pseudo-style-props/_active.js | 27 +
.../pseudo-style-props/_disabled.js | 56 ++
.../pseudo-style-props/_firstChild.js | 30 +
.../pseudo-style-props/_focus.js | 22 +
.../pseudo-style-props/_hover.js | 23 +
.../pseudo-style-props/_lastChild.js | 30 +
.../pseudo-style-props/_nthOfType.js | 34 +
.../pseudo-style-props/_nthOfType_even.js | 27 +
.../pseudo-style-props/_nthOfType_odd.js | 27 +
.../pseudo-style-props/_visited.js | 36 +
.../index.page.mdx.template | 93 +++
.../pseudo-style-props/pseudo-classes.js | 14 +
.../pseudo-style-props/pseudo-elements.js | 19 +
.../responsive-values.page.mdx | 0
.../pages/styled-system/style-props.page.mdx | 364 --------
.../styled-system/style-props/.gitignore | 1 +
.../index.page.mdx.template} | 0
.../pages/system/pseudo-style-props.page.mdx | 414 ---------
.../pages/system/style-props.page.mdx | 328 --------
.../react-docs/pages/theme/borders.page.mdx | 264 ------
.../pages/theme/borders/borders-keyword.js | 107 +++
.../theme/borders/borders-numeric-value.js | 96 +++
.../pages/theme/borders/index.page.mdx | 67 ++
.../pages/theme/breakpoints/breakpoints.js | 46 +
.../index.page.mdx} | 46 +-
.../index.page.mdx} | 4 +-
.../pages/theme/font-sizes.page.mdx | 34 -
.../pages/theme/font-sizes/font-sizes.js | 17 +
.../pages/theme/font-sizes/index.page.mdx | 23 +
.../pages/theme/font-weights.page.mdx | 24 -
.../pages/theme/font-weights/font-weights.js | 18 +
.../pages/theme/font-weights/index.page.mdx | 12 +
.../react-docs/pages/theme/fonts.page.mdx | 17 -
.../react-docs/pages/theme/fonts/fonts.js | 11 +
.../pages/theme/fonts/index.page.mdx | 12 +
.../index.page.mdx} | 2 +-
.../pages/theme/line-heights.page.mdx | 38 -
.../pages/theme/line-heights/index.page.mdx | 23 +
.../pages/theme/line-heights/line-heights.js | 21 +
.../react-docs/pages/theme/outlines.page.mdx | 193 -----
.../pages/theme/outlines/index.page.mdx | 68 ++
.../pages/theme/outlines/outlines-keyword.js | 67 ++
.../theme/outlines/outlines-numeric-value.js | 64 ++
.../react-docs/pages/theme/radii.page.mdx | 110 ---
.../pages/theme/radii/border-radius-circle.js | 25 +
.../pages/theme/radii/border-radius-lg.js | 25 +
.../pages/theme/radii/border-radius-md.js | 25 +
.../pages/theme/radii/border-radius-sm.js | 25 +
.../pages/theme/radii/index.page.mdx | 26 +
.../index.page.mdx} | 35 +-
.../react-docs/pages/theme/shadows/shadows.js | 33 +
.../{sizes.page.mdx => sizes/index.page.mdx} | 36 +-
.../pages/theme/sizes/sizes-height.js | 20 +
.../pages/theme/sizes/sizes-width.js | 20 +
.../{space.page.mdx => space/index.page.mdx} | 27 +-
.../react-docs/pages/theme/space/space.js | 27 +
.../pages/theme/z-indices/index.page.mdx | 12 +
.../z-indices.js} | 20 +-
.../scripts/extract-mdx-code-block.js | 41 +
packages/react-docs/scripts/update-docs.sh | 12 +-
packages/react/__tests__/index.js | 2 +-
packages/react/src/box/index.js | 2 -
.../src/{box => deprecated}/ControlBox.js | 7 +-
packages/react/src/index.js | 1 +
385 files changed, 9211 insertions(+), 9447 deletions(-)
create mode 100644 packages/react-docs/pages/components/alert/alert-actions.js
create mode 100644 packages/react-docs/pages/components/alert/close-an-alert-using-the-alertclosebutton-component.js
create mode 100644 packages/react-docs/pages/components/alert/close-an-alert-using-the-isclosable-prop.js
create mode 100644 packages/react-docs/pages/components/alert/customizing-the-background-color.js
create mode 100644 packages/react-docs/pages/components/alert/formatted-text.js
create mode 100644 packages/react-docs/pages/components/alert/pagination.js
create mode 100644 packages/react-docs/pages/components/alert/severity-levels.js
create mode 100644 packages/react-docs/pages/components/alert/the-icon-prop.js
create mode 100644 packages/react-docs/pages/components/alert/transition-effects.js
create mode 100644 packages/react-docs/pages/components/alert/variant-outline.js
create mode 100644 packages/react-docs/pages/components/alert/variant-solid.js
delete mode 100644 packages/react-docs/pages/components/badge.page.mdx
create mode 100644 packages/react-docs/pages/components/badge/badge-alignment.js
create mode 100644 packages/react-docs/pages/components/badge/badge-visibility.js
create mode 100644 packages/react-docs/pages/components/badge/basic.js
create mode 100644 packages/react-docs/pages/components/badge/color.js
create mode 100644 packages/react-docs/pages/components/badge/customization.js
create mode 100644 packages/react-docs/pages/components/badge/dot.js
create mode 100644 packages/react-docs/pages/components/badge/index.page.mdx
create mode 100644 packages/react-docs/pages/components/badge/size.js
create mode 100644 packages/react-docs/pages/components/badge/standalone.js
rename packages/react-docs/pages/components/{box.page.mdx => box/index.page.mdx} (60%)
create mode 100644 packages/react-docs/pages/components/box/using-pseudo-style-props.js
create mode 100644 packages/react-docs/pages/components/box/using-style-props.js
create mode 100644 packages/react-docs/pages/components/box/using-the-as-prop.js
create mode 100644 packages/react-docs/pages/components/box/using-the-sx-prop.js
rename packages/react-docs/pages/components/button-base/{disabled.js => attribute-disabled.js} (100%)
delete mode 100644 packages/react-docs/pages/components/checkbox-group.page.mdx
create mode 100644 packages/react-docs/pages/components/checkbox-group/asynchronous-data-loading.js
create mode 100644 packages/react-docs/pages/components/checkbox-group/colors.js
create mode 100644 packages/react-docs/pages/components/checkbox-group/controlled-checkbox-group.js
create mode 100644 packages/react-docs/pages/components/checkbox-group/group-orientation.js
create mode 100644 packages/react-docs/pages/components/checkbox-group/index.page.mdx
create mode 100644 packages/react-docs/pages/components/checkbox-group/sizes.js
create mode 100644 packages/react-docs/pages/components/checkbox-group/states.js
create mode 100644 packages/react-docs/pages/components/checkbox-group/uncontrolled-checkbox-group.js
create mode 100644 packages/react-docs/pages/components/checkbox/accessibility.js
create mode 100644 packages/react-docs/pages/components/checkbox/basic.js
create mode 100644 packages/react-docs/pages/components/checkbox/colors.js
create mode 100644 packages/react-docs/pages/components/checkbox/faq-input-ref.js
create mode 100644 packages/react-docs/pages/components/checkbox/flex-container.js
create mode 100644 packages/react-docs/pages/components/checkbox/indeterminate.js
rename packages/react-docs/pages/components/{checkbox.page.mdx => checkbox/index.page.mdx} (60%)
create mode 100644 packages/react-docs/pages/components/checkbox/sizes.js
create mode 100644 packages/react-docs/pages/components/checkbox/states.js
create mode 100644 packages/react-docs/pages/components/code/basic.js
rename packages/react-docs/pages/components/{code.page.mdx => code/index.page.mdx} (90%)
delete mode 100644 packages/react-docs/pages/components/control-box.page.mdx
rename packages/react-docs/pages/components/{css-baseline.page.mdx => css-baseline/index.page.mdx} (100%)
create mode 100644 packages/react-docs/pages/components/divider/basic.js
create mode 100644 packages/react-docs/pages/components/divider/composition.js
create mode 100644 packages/react-docs/pages/components/divider/horizontal-orientation.js
rename packages/react-docs/pages/components/{divider.page.mdx => divider/index.page.mdx} (50%)
create mode 100644 packages/react-docs/pages/components/divider/vertical-orientation.js
delete mode 100644 packages/react-docs/pages/components/flex.page.mdx
create mode 100644 packages/react-docs/pages/components/flex/align-items.js
create mode 100644 packages/react-docs/pages/components/flex/flex-direction.js
create mode 100644 packages/react-docs/pages/components/flex/flex-none.js
create mode 100644 packages/react-docs/pages/components/flex/flex-wrap.js
create mode 100644 packages/react-docs/pages/components/flex/index.page.mdx
create mode 100644 packages/react-docs/pages/components/flex/justify-content.js
delete mode 100644 packages/react-docs/pages/components/grid.page.mdx
create mode 100644 packages/react-docs/pages/components/grid/grid-area.js
create mode 100644 packages/react-docs/pages/components/grid/grid-auto-columns.js
create mode 100644 packages/react-docs/pages/components/grid/grid-auto-flow.js
create mode 100644 packages/react-docs/pages/components/grid/grid-auto-rows.js
create mode 100644 packages/react-docs/pages/components/grid/grid-column-gap.js
create mode 100644 packages/react-docs/pages/components/grid/grid-column.js
create mode 100644 packages/react-docs/pages/components/grid/grid-gap.js
create mode 100644 packages/react-docs/pages/components/grid/grid-row-gap.js
create mode 100644 packages/react-docs/pages/components/grid/grid-row.js
create mode 100644 packages/react-docs/pages/components/grid/grid-template-areas.js
create mode 100644 packages/react-docs/pages/components/grid/grid-template-columns.js
create mode 100644 packages/react-docs/pages/components/grid/grid-template-rows.js
create mode 100644 packages/react-docs/pages/components/grid/index.page.mdx
create mode 100644 packages/react-docs/pages/components/image/basic.js
create mode 100644 packages/react-docs/pages/components/image/index.page.mdx
rename packages/react-docs/pages/components/{image.page.mdx => image/inline-svg.js} (70%)
delete mode 100644 packages/react-docs/pages/components/input-base.page.mdx
create mode 100644 packages/react-docs/pages/components/input-base/attribute-disabled.js
create mode 100644 packages/react-docs/pages/components/input-base/attribute-readonly.js
create mode 100644 packages/react-docs/pages/components/input-base/attribute-required.js
create mode 100644 packages/react-docs/pages/components/input-base/attribute-type.js
create mode 100644 packages/react-docs/pages/components/input-base/basic.js
create mode 100644 packages/react-docs/pages/components/input-base/index.page.mdx
delete mode 100644 packages/react-docs/pages/components/input-control.page.mdx
create mode 100644 packages/react-docs/pages/components/input-control/index.page.mdx
create mode 100644 packages/react-docs/pages/components/input-control/input-adornments.js
create mode 100644 packages/react-docs/pages/components/input-control/usage.js
delete mode 100644 packages/react-docs/pages/components/input-group.page.mdx
create mode 100644 packages/react-docs/pages/components/input-group/basic.js
create mode 100644 packages/react-docs/pages/components/input-group/button-add-ons.js
create mode 100644 packages/react-docs/pages/components/input-group/date-inputs.js
create mode 100644 packages/react-docs/pages/components/input-group/index.page.mdx
create mode 100644 packages/react-docs/pages/components/input-group/multiple-add-ons.js
create mode 100644 packages/react-docs/pages/components/input-group/multiple-inputs.js
create mode 100644 packages/react-docs/pages/components/input-group/sizes.js
create mode 100644 packages/react-docs/pages/components/input-group/variant-filled.js
create mode 100644 packages/react-docs/pages/components/input-group/variant-flush.js
create mode 100644 packages/react-docs/pages/components/input-group/variant-outline.js
create mode 100644 packages/react-docs/pages/components/input-group/variant-unstyled.js
delete mode 100644 packages/react-docs/pages/components/input.page.mdx
create mode 100644 packages/react-docs/pages/components/input/attribute-disabled.js
create mode 100644 packages/react-docs/pages/components/input/attribute-list.js
create mode 100644 packages/react-docs/pages/components/input/attribute-readonly.js
create mode 100644 packages/react-docs/pages/components/input/attribute-required.js
create mode 100644 packages/react-docs/pages/components/input/attribute-type.js
create mode 100644 packages/react-docs/pages/components/input/basic.js
create mode 100644 packages/react-docs/pages/components/input/index.page.mdx
create mode 100644 packages/react-docs/pages/components/input/sizes.js
create mode 100644 packages/react-docs/pages/components/input/validation.js
create mode 100644 packages/react-docs/pages/components/input/variant-filled.js
create mode 100644 packages/react-docs/pages/components/input/variant-flush.js
create mode 100644 packages/react-docs/pages/components/input/variant-outline.js
create mode 100644 packages/react-docs/pages/components/input/variant-unstyled.js
create mode 100644 packages/react-docs/pages/components/link-button/basic.js
rename packages/react-docs/pages/components/{link-button.page.mdx => link-button/index.page.mdx} (53%)
delete mode 100644 packages/react-docs/pages/components/link.page.mdx
create mode 100644 packages/react-docs/pages/components/link/default.js
create mode 100644 packages/react-docs/pages/components/link/index.page.mdx
create mode 100644 packages/react-docs/pages/components/link/link-to-another-page.js
create mode 100644 packages/react-docs/pages/components/link/link-with-disabled-attribute.js
create mode 100644 packages/react-docs/pages/components/link/link-with-icon.js
create mode 100644 packages/react-docs/pages/components/link/underlined-link.js
create mode 100644 packages/react-docs/pages/components/menu/basic.js
create mode 100644 packages/react-docs/pages/components/menu/cascading-submenus.js
create mode 100644 packages/react-docs/pages/components/menu/controlled.js
create mode 100644 packages/react-docs/pages/components/menu/menubutton.js
create mode 100644 packages/react-docs/pages/components/menu/menugroup.js
create mode 100644 packages/react-docs/pages/components/menu/menutoggle-popover.js
create mode 100644 packages/react-docs/pages/components/menu/menutoggle.js
create mode 100644 packages/react-docs/pages/components/menu/menutoggleicon-custom.js
create mode 100644 packages/react-docs/pages/components/menu/menutoggleicon.js
create mode 100644 packages/react-docs/pages/components/menu/placement.js
create mode 100644 packages/react-docs/pages/components/menu/positioning.js
create mode 100644 packages/react-docs/pages/components/menu/scrolling-native.js
create mode 100644 packages/react-docs/pages/components/menu/scrolling-scrollbar.js
create mode 100644 packages/react-docs/pages/components/menu/sizing-fixed-width.js
create mode 100644 packages/react-docs/pages/components/menu/sizing-full-width.js
create mode 100644 packages/react-docs/pages/components/menu/sizing-max-content.js
create mode 100644 packages/react-docs/pages/components/menu/sizing-min-content.js
create mode 100644 packages/react-docs/pages/components/menu/uncontrolled.js
create mode 100644 packages/react-docs/pages/components/pagination/basic.js
create mode 100644 packages/react-docs/pages/components/pagination/controlled-pagination.js
create mode 100644 packages/react-docs/pages/components/pagination/customize-the-control-icons.js
create mode 100644 packages/react-docs/pages/components/pagination/pagination-buttons.js
create mode 100644 packages/react-docs/pages/components/pagination/pagination-ranges.js
create mode 100644 packages/react-docs/pages/components/pagination/table-pagination.js
create mode 100644 packages/react-docs/pages/components/pagination/usePagination.js
delete mode 100644 packages/react-docs/pages/components/progress.page.mdx
create mode 100644 packages/react-docs/pages/components/progress/custom-color.js
create mode 100644 packages/react-docs/pages/components/progress/index.page.mdx
create mode 100644 packages/react-docs/pages/components/progress/usage.js
delete mode 100644 packages/react-docs/pages/components/radio-group.page.mdx
create mode 100644 packages/react-docs/pages/components/radio-group/asynchronous-data-loading.js
create mode 100644 packages/react-docs/pages/components/radio-group/colors.js
create mode 100644 packages/react-docs/pages/components/radio-group/controlled-radio-group.js
create mode 100644 packages/react-docs/pages/components/radio-group/group-orientation.js
create mode 100644 packages/react-docs/pages/components/radio-group/index.page.mdx
create mode 100644 packages/react-docs/pages/components/radio-group/sizes.js
create mode 100644 packages/react-docs/pages/components/radio-group/states.js
create mode 100644 packages/react-docs/pages/components/radio-group/uncontrolled-radio-group.js
create mode 100644 packages/react-docs/pages/components/radio/accessibility.js
create mode 100644 packages/react-docs/pages/components/radio/basic.js
create mode 100644 packages/react-docs/pages/components/radio/colors.js
create mode 100644 packages/react-docs/pages/components/radio/faq-input-ref.js
create mode 100644 packages/react-docs/pages/components/radio/flex-container.js
rename packages/react-docs/pages/components/{radio.page.mdx => radio/index.page.mdx} (70%)
create mode 100644 packages/react-docs/pages/components/radio/sizes.js
create mode 100644 packages/react-docs/pages/components/radio/states.js
delete mode 100644 packages/react-docs/pages/components/search-input.page.mdx
create mode 100644 packages/react-docs/pages/components/search-input/attribute-disabled.js
create mode 100644 packages/react-docs/pages/components/search-input/attribute-readonly.js
create mode 100644 packages/react-docs/pages/components/search-input/attribute-required.js
create mode 100644 packages/react-docs/pages/components/search-input/basic.js
create mode 100644 packages/react-docs/pages/components/search-input/index.page.mdx
create mode 100644 packages/react-docs/pages/components/search-input/keyword-search.js
create mode 100644 packages/react-docs/pages/components/search-input/sizes.js
create mode 100644 packages/react-docs/pages/components/search-input/variant-filled.js
create mode 100644 packages/react-docs/pages/components/search-input/variant-flush.js
create mode 100644 packages/react-docs/pages/components/search-input/variant-outline.js
create mode 100644 packages/react-docs/pages/components/search-input/variant-unstyled.js
delete mode 100644 packages/react-docs/pages/components/select.page.mdx
create mode 100644 packages/react-docs/pages/components/select/attribute-disabled.js
create mode 100644 packages/react-docs/pages/components/select/attribute-required.js
create mode 100644 packages/react-docs/pages/components/select/basic.js
create mode 100644 packages/react-docs/pages/components/select/index.page.mdx
create mode 100644 packages/react-docs/pages/components/select/multiple-options.js
create mode 100644 packages/react-docs/pages/components/select/variant-filled.js
create mode 100644 packages/react-docs/pages/components/select/variant-outline.js
create mode 100644 packages/react-docs/pages/components/select/variant-unstyled.js
delete mode 100644 packages/react-docs/pages/components/skeleton.page.mdx
create mode 100644 packages/react-docs/pages/components/skeleton/animations.js
create mode 100644 packages/react-docs/pages/components/skeleton/color.js
create mode 100644 packages/react-docs/pages/components/skeleton/index.page.mdx
create mode 100644 packages/react-docs/pages/components/skeleton/modal-skeletons.js
create mode 100644 packages/react-docs/pages/components/skeleton/profile-skeletons.js
create mode 100644 packages/react-docs/pages/components/skeleton/variants.js
delete mode 100644 packages/react-docs/pages/components/space.page.mdx
create mode 100644 packages/react-docs/pages/components/space/horizontal-spacing.js
create mode 100644 packages/react-docs/pages/components/space/index.page.mdx
create mode 100644 packages/react-docs/pages/components/space/vertical-spacing.js
create mode 100644 packages/react-docs/pages/components/spinner/basic.js
create mode 100644 packages/react-docs/pages/components/spinner/customization.js
rename packages/react-docs/pages/components/{spinner.page.mdx => spinner/index.page.mdx} (70%)
create mode 100644 packages/react-docs/pages/components/spinner/sizes.js
create mode 100644 packages/react-docs/pages/components/stack/index.page.mdx
rename packages/react-docs/pages/components/{stack.page.mdx => stack/usage.js} (70%)
delete mode 100644 packages/react-docs/pages/components/svg-icon.page.mdx
create mode 100644 packages/react-docs/pages/components/svg-icon/basic.js
create mode 100644 packages/react-docs/pages/components/svg-icon/custom-icon.js
create mode 100644 packages/react-docs/pages/components/svg-icon/index.page.mdx
rename packages/react-docs/pages/components/switch/{faq-input-element.js => faq-input-ref.js} (83%)
create mode 100644 packages/react-docs/pages/components/tag/basic.js
rename packages/react-docs/pages/components/tag/{input-tag.js => creating-tags.js} (100%)
create mode 100644 packages/react-docs/pages/components/tag/custom-colors.js
create mode 100644 packages/react-docs/pages/components/tag/sizes.js
create mode 100644 packages/react-docs/pages/components/tag/states.js
create mode 100644 packages/react-docs/pages/components/tag/using-the-isclosable-prop.js
create mode 100644 packages/react-docs/pages/components/tag/using-the-tagclosebutton-component.js
create mode 100644 packages/react-docs/pages/components/tag/variants.js
create mode 100644 packages/react-docs/pages/components/text-label/basic.js
rename packages/react-docs/pages/components/{text-label.page.mdx => text-label/index.page.mdx} (91%)
delete mode 100644 packages/react-docs/pages/components/text.page.mdx
create mode 100644 packages/react-docs/pages/components/text/formatting-text.js
create mode 100644 packages/react-docs/pages/components/text/headings.js
create mode 100644 packages/react-docs/pages/components/text/index.page.mdx
create mode 100644 packages/react-docs/pages/components/text/sizes.js
create mode 100644 packages/react-docs/pages/components/text/text-truncation.js
create mode 100644 packages/react-docs/pages/components/text/the-as-prop.js
delete mode 100644 packages/react-docs/pages/components/textarea.page.mdx
create mode 100644 packages/react-docs/pages/components/textarea/attribute-disabled.js
create mode 100644 packages/react-docs/pages/components/textarea/attribute-readonly.js
create mode 100644 packages/react-docs/pages/components/textarea/attribute-required.js
create mode 100644 packages/react-docs/pages/components/textarea/basic.js
create mode 100644 packages/react-docs/pages/components/textarea/index.page.mdx
create mode 100644 packages/react-docs/pages/components/textarea/sizing.js
create mode 100644 packages/react-docs/pages/components/textarea/validation.js
create mode 100644 packages/react-docs/pages/components/textarea/variant-filled.js
create mode 100644 packages/react-docs/pages/components/textarea/variant-outline.js
create mode 100644 packages/react-docs/pages/components/textarea/variant-unstyled.js
delete mode 100644 packages/react-docs/pages/components/truncate.page.mdx
create mode 100644 packages/react-docs/pages/components/truncate/container-width.js
create mode 100644 packages/react-docs/pages/components/truncate/expand-on-hover.js
create mode 100644 packages/react-docs/pages/components/truncate/faq-line-clamp.js
create mode 100644 packages/react-docs/pages/components/truncate/index.page.mdx
create mode 100644 packages/react-docs/pages/components/truncate/overflow-tooltip.js
create mode 100644 packages/react-docs/pages/components/truncate/truncate-width.js
create mode 100644 packages/react-docs/pages/components/visually-hidden/basic.js
rename packages/react-docs/pages/components/{visually-hidden.page.mdx => visually-hidden/index.page.mdx} (79%)
delete mode 100644 packages/react-docs/pages/getting-started/.gitignore
rename packages/react-docs/pages/getting-started/{contributing.page.mdx => contributing/index.page.mdx} (100%)
delete mode 100644 packages/react-docs/pages/getting-started/css-variables.page.mdx
create mode 100644 packages/react-docs/pages/getting-started/css-variables/default-css-variables.js
create mode 100644 packages/react-docs/pages/getting-started/css-variables/index.page.mdx
rename packages/react-docs/pages/getting-started/{installation.page.mdx => installation/index.page.mdx} (100%)
rename packages/react-docs/pages/getting-started/{migration-v0x.page.mdx => migration-v0x/index.page.mdx} (100%)
rename packages/react-docs/pages/getting-started/{security.page.mdx => security/index.page.mdx} (100%)
delete mode 100644 packages/react-docs/pages/getting-started/the-sx-prop.page.mdx
create mode 100644 packages/react-docs/pages/getting-started/the-sx-prop/array-of-callbacks.js
create mode 100644 packages/react-docs/pages/getting-started/the-sx-prop/array-of-objects.js
create mode 100644 packages/react-docs/pages/getting-started/the-sx-prop/creating-a-custom-button.js
create mode 100644 packages/react-docs/pages/getting-started/the-sx-prop/defining-css-custom-properties.js
create mode 100644 packages/react-docs/pages/getting-started/the-sx-prop/index.page.mdx
create mode 100644 packages/react-docs/pages/getting-started/the-sx-prop/passing-the-sx-prop.js
create mode 100644 packages/react-docs/pages/getting-started/the-sx-prop/using-media-queries.js
rename packages/react-docs/pages/getting-started/{ => usage}/components/AnimatedCube.js (100%)
rename packages/react-docs/pages/getting-started/{ => usage}/components/FormulaOne.js (100%)
rename packages/react-docs/pages/getting-started/{ => usage}/components/Rainbow.js (100%)
rename packages/react-docs/pages/getting-started/{usage.page.mdx => usage/index.page.mdx} (95%)
create mode 100644 packages/react-docs/pages/getting-started/usage/using-style-props-and-pseudo-style-props.js
create mode 100644 packages/react-docs/pages/getting-started/versions/.gitignore
rename packages/react-docs/pages/getting-started/{versions.page.mdx.template => versions/index.page.mdx.template} (100%)
create mode 100644 packages/react-docs/pages/hooks/useCallback.js
create mode 100644 packages/react-docs/pages/hooks/useConst.js
create mode 100644 packages/react-docs/pages/hooks/useCopyToClipboard.js
create mode 100644 packages/react-docs/pages/hooks/useEffectOnce.js
create mode 100644 packages/react-docs/pages/hooks/useEffectOnceWhen.js
create mode 100644 packages/react-docs/pages/hooks/useEventCallback.js
create mode 100644 packages/react-docs/pages/hooks/useEventListener.js
create mode 100644 packages/react-docs/pages/hooks/useHydrated.js
create mode 100644 packages/react-docs/pages/hooks/useIsomorphicEffect.js
create mode 100644 packages/react-docs/pages/hooks/useLatestRef.js
create mode 100644 packages/react-docs/pages/hooks/useMediaQuery.js
create mode 100644 packages/react-docs/pages/hooks/useMergeRefs.js
create mode 100644 packages/react-docs/pages/hooks/useOnce.js
create mode 100644 packages/react-docs/pages/hooks/useOnceWhen.js
create mode 100644 packages/react-docs/pages/hooks/useOutsideClick.js
create mode 100644 packages/react-docs/pages/hooks/usePrevious.js
create mode 100644 packages/react-docs/pages/hooks/useToggle.js
create mode 100644 packages/react-docs/pages/lab/date-pickers/date-pickers.js
create mode 100644 packages/react-docs/pages/lab/date-pickers/native-pickers.js
delete mode 100644 packages/react-docs/pages/styled-system/.gitignore
delete mode 100644 packages/react-docs/pages/styled-system/pseudo-style-props.page.mdx
delete mode 100644 packages/react-docs/pages/styled-system/pseudo-style-props.page.mdx.template
create mode 100644 packages/react-docs/pages/styled-system/pseudo-style-props/.gitignore
create mode 100644 packages/react-docs/pages/styled-system/pseudo-style-props/_active.js
create mode 100644 packages/react-docs/pages/styled-system/pseudo-style-props/_disabled.js
create mode 100644 packages/react-docs/pages/styled-system/pseudo-style-props/_firstChild.js
create mode 100644 packages/react-docs/pages/styled-system/pseudo-style-props/_focus.js
create mode 100644 packages/react-docs/pages/styled-system/pseudo-style-props/_hover.js
create mode 100644 packages/react-docs/pages/styled-system/pseudo-style-props/_lastChild.js
create mode 100644 packages/react-docs/pages/styled-system/pseudo-style-props/_nthOfType.js
create mode 100644 packages/react-docs/pages/styled-system/pseudo-style-props/_nthOfType_even.js
create mode 100644 packages/react-docs/pages/styled-system/pseudo-style-props/_nthOfType_odd.js
create mode 100644 packages/react-docs/pages/styled-system/pseudo-style-props/_visited.js
create mode 100644 packages/react-docs/pages/styled-system/pseudo-style-props/index.page.mdx.template
create mode 100644 packages/react-docs/pages/styled-system/pseudo-style-props/pseudo-classes.js
create mode 100644 packages/react-docs/pages/styled-system/pseudo-style-props/pseudo-elements.js
rename packages/react-docs/pages/styled-system/{ => responsive-values}/responsive-values.page.mdx (100%)
delete mode 100644 packages/react-docs/pages/styled-system/style-props.page.mdx
create mode 100644 packages/react-docs/pages/styled-system/style-props/.gitignore
rename packages/react-docs/pages/styled-system/{style-props.page.mdx.template => style-props/index.page.mdx.template} (100%)
delete mode 100644 packages/react-docs/pages/system/pseudo-style-props.page.mdx
delete mode 100644 packages/react-docs/pages/system/style-props.page.mdx
delete mode 100644 packages/react-docs/pages/theme/borders.page.mdx
create mode 100644 packages/react-docs/pages/theme/borders/borders-keyword.js
create mode 100644 packages/react-docs/pages/theme/borders/borders-numeric-value.js
create mode 100644 packages/react-docs/pages/theme/borders/index.page.mdx
create mode 100644 packages/react-docs/pages/theme/breakpoints/breakpoints.js
rename packages/react-docs/pages/theme/{breakpoints.page.mdx => breakpoints/index.page.mdx} (52%)
rename packages/react-docs/pages/theme/{colors.page.mdx => colors/index.page.mdx} (84%)
delete mode 100644 packages/react-docs/pages/theme/font-sizes.page.mdx
create mode 100644 packages/react-docs/pages/theme/font-sizes/font-sizes.js
create mode 100644 packages/react-docs/pages/theme/font-sizes/index.page.mdx
delete mode 100644 packages/react-docs/pages/theme/font-weights.page.mdx
create mode 100644 packages/react-docs/pages/theme/font-weights/font-weights.js
create mode 100644 packages/react-docs/pages/theme/font-weights/index.page.mdx
delete mode 100644 packages/react-docs/pages/theme/fonts.page.mdx
create mode 100644 packages/react-docs/pages/theme/fonts/fonts.js
create mode 100644 packages/react-docs/pages/theme/fonts/index.page.mdx
rename packages/react-docs/pages/theme/{letter-spacings.page.mdx => letter-spacings/index.page.mdx} (76%)
delete mode 100644 packages/react-docs/pages/theme/line-heights.page.mdx
create mode 100644 packages/react-docs/pages/theme/line-heights/index.page.mdx
create mode 100644 packages/react-docs/pages/theme/line-heights/line-heights.js
delete mode 100644 packages/react-docs/pages/theme/outlines.page.mdx
create mode 100644 packages/react-docs/pages/theme/outlines/index.page.mdx
create mode 100644 packages/react-docs/pages/theme/outlines/outlines-keyword.js
create mode 100644 packages/react-docs/pages/theme/outlines/outlines-numeric-value.js
delete mode 100644 packages/react-docs/pages/theme/radii.page.mdx
create mode 100644 packages/react-docs/pages/theme/radii/border-radius-circle.js
create mode 100644 packages/react-docs/pages/theme/radii/border-radius-lg.js
create mode 100644 packages/react-docs/pages/theme/radii/border-radius-md.js
create mode 100644 packages/react-docs/pages/theme/radii/border-radius-sm.js
create mode 100644 packages/react-docs/pages/theme/radii/index.page.mdx
rename packages/react-docs/pages/theme/{shadows.page.mdx => shadows/index.page.mdx} (52%)
create mode 100644 packages/react-docs/pages/theme/shadows/shadows.js
rename packages/react-docs/pages/theme/{sizes.page.mdx => sizes/index.page.mdx} (62%)
create mode 100644 packages/react-docs/pages/theme/sizes/sizes-height.js
create mode 100644 packages/react-docs/pages/theme/sizes/sizes-width.js
rename packages/react-docs/pages/theme/{space.page.mdx => space/index.page.mdx} (67%)
create mode 100644 packages/react-docs/pages/theme/space/space.js
create mode 100644 packages/react-docs/pages/theme/z-indices/index.page.mdx
rename packages/react-docs/pages/theme/{z-indices.page.mdx => z-indices/z-indices.js} (83%)
create mode 100644 packages/react-docs/scripts/extract-mdx-code-block.js
rename packages/react/src/{box => deprecated}/ControlBox.js (92%)
diff --git a/packages/react-docs/config/sidebar-routes.js b/packages/react-docs/config/sidebar-routes.js
index 7a6b2d07f0..7f857d7043 100644
--- a/packages/react-docs/config/sidebar-routes.js
+++ b/packages/react-docs/config/sidebar-routes.js
@@ -142,7 +142,6 @@ export const routes = [
{ title: 'LAYOUT', heading: true },
{ title: 'Box', path: 'components/box' },
- //{ title: 'ControlBox', path: 'components/control-box' }, // XXX: internal use only
{ title: 'Flex', path: 'components/flex' },
{ title: 'Grid', path: 'components/grid' },
{ title: 'Space', path: 'components/space' },
diff --git a/packages/react-docs/pages/components/alert/alert-actions.js b/packages/react-docs/pages/components/alert/alert-actions.js
new file mode 100644
index 0000000000..b544910553
--- /dev/null
+++ b/packages/react-docs/pages/components/alert/alert-actions.js
@@ -0,0 +1,66 @@
+import { Alert, Button, Flex, LinkButton, Stack, Text } from '@tonic-ui/react';
+import React, { forwardRef } from 'react';
+
+const ActionButton = forwardRef((props, ref) => (
+
+));
+ActionButton.displayName = 'ActionButton';
+
+const App = () => (
+
+
+
+ This is a warning alert.
+ Learn More
+
+
+
+
+ This is an error alert.
+
+ Action Button
+
+
+
+
+
+ This is a warning alert.
+ Learn More
+
+
+
+
+ This is an error alert.
+
+ Action Button
+
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/alert/close-an-alert-using-the-alertclosebutton-component.js b/packages/react-docs/pages/components/alert/close-an-alert-using-the-alertclosebutton-component.js
new file mode 100644
index 0000000000..7b58aa856a
--- /dev/null
+++ b/packages/react-docs/pages/components/alert/close-an-alert-using-the-alertclosebutton-component.js
@@ -0,0 +1,17 @@
+import { Alert, AlertCloseButton, Collapse, Text } from '@tonic-ui/react';
+import { useToggle } from '@tonic-ui/react-hooks';
+import React from 'react';
+
+const App = () => {
+ const [isOpen, onClose] = useToggle(true);
+ return (
+
+
+ This is a success alert.
+
+
+
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/alert/close-an-alert-using-the-isclosable-prop.js b/packages/react-docs/pages/components/alert/close-an-alert-using-the-isclosable-prop.js
new file mode 100644
index 0000000000..d95a1df921
--- /dev/null
+++ b/packages/react-docs/pages/components/alert/close-an-alert-using-the-isclosable-prop.js
@@ -0,0 +1,16 @@
+import { Alert, Collapse, Text } from '@tonic-ui/react';
+import { useToggle } from '@tonic-ui/react-hooks';
+import React from 'react';
+
+const App = () => {
+ const [isOpen, onClose] = useToggle(true);
+ return (
+
+
+ This is a success alert.
+
+
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/alert/customizing-the-background-color.js b/packages/react-docs/pages/components/alert/customizing-the-background-color.js
new file mode 100644
index 0000000000..713bc2afb6
--- /dev/null
+++ b/packages/react-docs/pages/components/alert/customizing-the-background-color.js
@@ -0,0 +1,25 @@
+import { Alert, Stack, Text } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+ This is a promotion message
+
+
+ This is a promotion message
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/alert/formatted-text.js b/packages/react-docs/pages/components/alert/formatted-text.js
new file mode 100644
index 0000000000..58c0a04799
--- /dev/null
+++ b/packages/react-docs/pages/components/alert/formatted-text.js
@@ -0,0 +1,41 @@
+import { Alert, Box, Stack, Text } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+
+ Success
+
+
+ This is a success alert.
+
+
+
+
+ Info
+
+
+ This is an info alert.
+
+
+
+
+ Warning
+
+
+ This is a warning alert.
+
+
+
+
+ Error
+
+
+ This is an error alert.
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/alert/index.page.mdx b/packages/react-docs/pages/components/alert/index.page.mdx
index 1f18f906d5..92186ad3a9 100644
--- a/packages/react-docs/pages/components/alert/index.page.mdx
+++ b/packages/react-docs/pages/components/alert/index.page.mdx
@@ -21,111 +21,30 @@ You can use the `variant` prop to change the appearance of the alert. The varian
The `solid` variant is used to indicate an important message.
-```jsx
-
- This is an important message.
-
-```
+{render('./variant-solid')}
#### Outline
The `outline` variant is useful for displaying a contextual alert that is not a part of the primary flow of the application.
-```jsx
-
- This is a contextual alert.
-
-```
+{render('./variant-outline')}
### Severity levels
The `severity` prop can be used to specify the severity level of the alert. The severity levels are: `success`, `info`, `warning`, and `error`. The default severity level is `success`.
-```jsx
-
-
- This is a success alert.
-
-
- This is an info alert.
-
-
- This is a warning alert.
-
-
- This is an error alert.
-
-
- This is a success alert.
-
-
- This is an info alert.
-
-
- This is a warning alert.
-
-
- This is an error alert.
-
-
-```
+{render('./severity-levels')}
### `icon` prop
The `icon` prop allows you to specify an icon to be displayed in the alert.
If not specified, the default icon will be used based on the `severity` prop.
-```jsx
-
-
- This is a success alert.
-
-
- This is a success alert.
-
- }>
- This is a success alert.
-
-
- This is a success alert.
-
-
- This is a success alert.
-
-
- This is a success alert.
-
- }>
- This is a success alert.
-
-
- This is a success alert.
-
-
-```
+{render('./the-icon-prop')}
### Customizing the background color
-```jsx
-
-
- This is a promotion message
-
-
- This is a promotion message
-
-
-```
+{render('./customizing-the-background-color')}
### How to close an alert
@@ -139,18 +58,7 @@ The `isClosable` prop is used to make an alert closable by adding a close button
```
-```jsx noInline
-render(() => {
- const [isOpen, onClose] = useToggle(true);
- return (
-
-
- This is a success alert.
-
-
- );
-});
-```
+{render('./close-an-alert-using-the-isclosable-prop')}
#### Using the `AlertCloseButton` component
@@ -167,19 +75,7 @@ Besides the default functionality of the `AlertCloseButton`, you can also pass a
When using the `AlertCloseButton` component, be sure to manually adjust its position. In the example above, the close button is positioned absolutely, with 3 pixels from the top and 7 pixels from the right of its parent element.
-```jsx noInline
-render(() => {
- const [isOpen, onClose] = useToggle(true);
- return (
-
-
- This is a success alert.
-
-
-
- );
-});
-```
+{render('./close-an-alert-using-the-alertclosebutton-component')}
### Alert actions
@@ -187,203 +83,25 @@ An alert action is a button or link to trigger an action. It is used to provide
The action button is usually aligned to the right of the alert. You can use `justifyContent` to align the action button to the right.
-```jsx noInline
-const ActionButton = React.forwardRef((props, ref) => (
-
-));
-
-function Example() {
- return (
-
-
-
- This is a warning alert.
- Learn More
-
-
-
-
- This is an error alert.
-
- Action Button
-
-
-
-
-
- This is a warning alert.
- Learn More
-
-
-
-
- This is an error alert.
-
- Action Button
-
-
-
-
- );
-}
-
-render( );
-```
+{render('./alert-actions')}
### Formatted text
You can use the `Text` component to format text.
-```jsx
-
-
-
- Success
-
-
- This is a success alert.
-
-
-
-
- Info
-
-
- This is an info alert.
-
-
-
-
- Warning
-
-
- This is a warning alert.
-
-
-
-
- Error
-
-
- This is an error alert.
-
-
-
-```
+{render('./formatted-text')}
### Pagination
For some use cases, you may want to display a list of alerts using pagination to reduce the number of visible alerts on the screen.
-```jsx noInline
-const alerts = [
- { variant: 'solid', severity: 'success', icon: 'success', message: 'This is a success alert' },
- { variant: 'solid', severity: 'info', icon: 'info', message: 'This is an info alert' },
- { variant: 'solid', severity: 'warning', icon: 'warning-minor', message: 'This is a warning alert' },
- { variant: 'solid', severity: 'error', icon: 'error', message: 'This is an error alert' },
-];
-const pageMin = alerts.length > 0 ? 1 : 0;
-const pageMax = alerts.length > 0 ? alerts.length : 0;
-
-const IconButton = (props) => (
-
-);
-
-function Example() {
- const [page, setPage] = React.useState(pageMin);
- const alert = alerts[page - 1] || {};
-
- return (
-
-
- {alert.message}
-
- setPage(Math.max(pageMin, page - 1))}
- >
-
-
- {page}/{pageMax}
- = pageMax}
- onClick={() => setPage(Math.min(pageMax, page + 1))}
- >
-
-
-
-
-
- );
-}
-
-render( );
-```
+{render('./pagination')}
### Transition effects
To animate the alert, you can use a transition component to apply an animation effect.
-```jsx
-function Example() {
- const [isOpen, setIsOpen] = React.useState(true);
- const handleOpen = () => setIsOpen(true);
- const handleClose = () => setIsOpen(false);
-
- return (
- <>
-
-
- Click the close button on the right side.
-
-
-
-
- Reopen
-
-
- >
- );
-}
-```
+{render('./transition-effects')}
## Props
diff --git a/packages/react-docs/pages/components/alert/pagination.js b/packages/react-docs/pages/components/alert/pagination.js
new file mode 100644
index 0000000000..81ea63fc28
--- /dev/null
+++ b/packages/react-docs/pages/components/alert/pagination.js
@@ -0,0 +1,59 @@
+import { Alert, ButtonBase, Flex, Icon, Text } from '@tonic-ui/react';
+import React, { useState } from 'react';
+
+const alerts = [
+ { variant: 'solid', severity: 'success', icon: 'success', message: 'This is a success alert' },
+ { variant: 'solid', severity: 'info', icon: 'info', message: 'This is an info alert' },
+ { variant: 'solid', severity: 'warning', icon: 'warning-minor', message: 'This is a warning alert' },
+ { variant: 'solid', severity: 'error', icon: 'error', message: 'This is an error alert' },
+];
+const pageMin = alerts.length > 0 ? 1 : 0;
+const pageMax = alerts.length > 0 ? alerts.length : 0;
+
+const IconButton = (props) => (
+
+);
+
+const App = () => {
+ const [page, setPage] = useState(pageMin);
+ const alert = alerts[page - 1] || {};
+
+ return (
+
+
+ {alert.message}
+
+ setPage(Math.max(pageMin, page - 1))}
+ >
+
+
+ {page}/{pageMax}
+ = pageMax}
+ onClick={() => setPage(Math.min(pageMax, page + 1))}
+ >
+
+
+
+
+
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/alert/severity-levels.js b/packages/react-docs/pages/components/alert/severity-levels.js
new file mode 100644
index 0000000000..feb257f449
--- /dev/null
+++ b/packages/react-docs/pages/components/alert/severity-levels.js
@@ -0,0 +1,33 @@
+import { Alert, Stack, Text } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+ This is a success alert.
+
+
+ This is an info alert.
+
+
+ This is a warning alert.
+
+
+ This is an error alert.
+
+
+ This is a success alert.
+
+
+ This is an info alert.
+
+
+ This is a warning alert.
+
+
+ This is an error alert.
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/alert/the-icon-prop.js b/packages/react-docs/pages/components/alert/the-icon-prop.js
new file mode 100644
index 0000000000..660495a875
--- /dev/null
+++ b/packages/react-docs/pages/components/alert/the-icon-prop.js
@@ -0,0 +1,33 @@
+import { Alert, Icon, Stack } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+ This is a success alert.
+
+
+ This is a success alert.
+
+ }>
+ This is a success alert.
+
+
+ This is a success alert.
+
+
+ This is a success alert.
+
+
+ This is a success alert.
+
+ }>
+ This is a success alert.
+
+
+ This is a success alert.
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/alert/transition-effects.js b/packages/react-docs/pages/components/alert/transition-effects.js
new file mode 100644
index 0000000000..0b244d763a
--- /dev/null
+++ b/packages/react-docs/pages/components/alert/transition-effects.js
@@ -0,0 +1,25 @@
+import { Alert, Box, Button, Collapse } from '@tonic-ui/react';
+import React, { useState } from 'react';
+
+const App = () => {
+ const [isOpen, setIsOpen] = useState(true);
+ const handleOpen = () => setIsOpen(true);
+ const handleClose = () => setIsOpen(false);
+
+ return (
+ <>
+
+
+ Click the close button on the right side.
+
+
+
+
+ Reopen
+
+
+ >
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/alert/variant-outline.js b/packages/react-docs/pages/components/alert/variant-outline.js
new file mode 100644
index 0000000000..b2f8cb0d67
--- /dev/null
+++ b/packages/react-docs/pages/components/alert/variant-outline.js
@@ -0,0 +1,10 @@
+import { Alert, Text } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+ This is a contextual alert.
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/alert/variant-solid.js b/packages/react-docs/pages/components/alert/variant-solid.js
new file mode 100644
index 0000000000..5970c946b7
--- /dev/null
+++ b/packages/react-docs/pages/components/alert/variant-solid.js
@@ -0,0 +1,10 @@
+import { Alert, Text } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+ This is an important message.
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/badge.page.mdx b/packages/react-docs/pages/components/badge.page.mdx
deleted file mode 100644
index 1c6f55d9aa..0000000000
--- a/packages/react-docs/pages/components/badge.page.mdx
+++ /dev/null
@@ -1,320 +0,0 @@
-# Badge
-
-Badges are used to highlight an item's status for quick recognition.
-
-## Import
-
-```js
-import { Badge } from '@tonic-ui/react';
-```
-
-## Usage
-
-### Basic badge
-
-To display the badge on the top-right corner of the wrapped component, specify the `badgeContent` prop with the desired content.
-
-```jsx
-
-
-
-
-
-
-
-
-
-
-
-
-
- !}
- >
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- !}
- >
-
-
-
-```
-
-### Dot badge
-
-Use `variant="dot"` to change a badge into a small dot. This can be used as a notification that something has changed without giving a count.
-
-```jsx
-
- // Pass `isInvisible` to make it invisible
-
-
-
-
-
-
-
-
-
-
-```
-
-### Standalone badge
-
-The badge can be used as a standalone component. This can be useful for displaying a badge without a surrounding element.
-
-```jsx
-
-
-
-
-
- } height="6x" />
-
-```
-
-### Badge alignment
-
-You can use the `placement` prop to move the badge to any corner of the wrapped element. The default placement is `top-right`. The `placement` prop can be one of `top-left`, `top-right`, `bottom-left`, `bottom-right`.
-
-```jsx
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-```
-
-### Badge visibility
-
-The badge visibility can be controlled using the `isInvisible` prop.
-
-```jsx
-function Example() {
- const [count, setCount] = React.useState(1);
- const [isInvisible, setIsInvisible] = React.useState(false);
-
- return (
-
-
-
- 0)}>
-
-
-
-
- {
- setCount(Math.max(count - 1, 0));
- }}
- >
-
-
- {
- setCount(Math.max(count + 1, 0));
- }}
- >
-
-
-
-
-
-
-
-
-
-
-
-
- {
- setIsInvisible(!isInvisible);
- }}
- />
-
- Show Badge
-
-
-
-
- );
-}
-```
-
-### Color
-
-The color of the badge can be changed by passing the `backgroundColor` prop. See the [colors](../theme/colors) section to learn more about colors.
-
-```jsx
-function Example() {
- const colors = [
- 'red:60',
- 'orange:50',
- 'yellow:50',
- 'green:60',
- 'blue:60',
- 'gray:60',
- 'magenta:60',
- 'purple:60',
- 'teal:60',
- 'cyan:60',
- ];
-
- return (
-
- {colors.map(color => (
-
-
-
- ))}
-
- );
-}
-```
-
-### Size
-
-The size of the badge can be changed by passing the `height` and `minWidth` props.
-
-```jsx
-
-
-
-
-
-
-
-
-
-
-
-```
-
-### Customization
-
-You can customize the badge style by passing style props. See the following example to learn how to create a outline badge.
-
-```jsx noInline
-const OutlineBadge = React.forwardRef((props, ref) => {
- const [colorMode] = useColorMode();
- const backgroundColor = {
- dark: 'gray:100',
- light: 'white',
- }[colorMode];
- const borderColor = {
- dark: 'yellow:50',
- light: 'yellow:50',
- }[colorMode];
- const borderStyle = 'solid';
- const borderWidth = '2px';
- const color = {
- dark: 'white:primary',
- light: 'black:primary',
- }[colorMode];
- const height = '5x';
- const minWidth = '5x';
-
- return (
-
- );
-});
-
-function Example() {
- return (
-
-
-
-
-
-
-
- !}
- >
-
-
-
- );
-}
-
-render( );
-```
-
-## Props
-
-### Badge
-
-| Name | Type | Default | Description |
-| :--- | :--- | :------ | :---------- |
-| children | ReactNode | | |
-| badgeContent | ReactNode \| number \| string | | The badge content. |
-| isInvisible | boolean | | Whether the badge is invisible. |
-| placement | string | 'top-right' | The placement of the badge. One of: 'top-left', 'top-right', 'bottom-left', 'bottom-right'. |
-| variant | string | 'solid' | One of: 'solid', 'dot' |
diff --git a/packages/react-docs/pages/components/badge/badge-alignment.js b/packages/react-docs/pages/components/badge/badge-alignment.js
new file mode 100644
index 0000000000..1a1237797e
--- /dev/null
+++ b/packages/react-docs/pages/components/badge/badge-alignment.js
@@ -0,0 +1,27 @@
+import { Badge, Grid, Icon } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/badge/badge-visibility.js b/packages/react-docs/pages/components/badge/badge-visibility.js
new file mode 100644
index 0000000000..04c5eb1446
--- /dev/null
+++ b/packages/react-docs/pages/components/badge/badge-visibility.js
@@ -0,0 +1,64 @@
+import { Badge, Box, Button, ButtonGroup, Flex, Icon, Space, Stack, Switch, Text, TextLabel } from '@tonic-ui/react';
+import React, { useState } from 'react';
+
+const App = () => {
+ const [count, setCount] = useState(1);
+ const [isInvisible, setIsInvisible] = useState(false);
+
+ return (
+
+
+
+ 0)}>
+
+
+
+
+ {
+ setCount(Math.max(count - 1, 0));
+ }}
+ >
+
+
+ {
+ setCount(Math.max(count + 1, 0));
+ }}
+ >
+
+
+
+
+
+
+
+
+
+
+
+
+ {
+ setIsInvisible(!isInvisible);
+ }}
+ />
+
+ Show Badge
+
+
+
+
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/badge/basic.js b/packages/react-docs/pages/components/badge/basic.js
new file mode 100644
index 0000000000..3b85663a65
--- /dev/null
+++ b/packages/react-docs/pages/components/badge/basic.js
@@ -0,0 +1,50 @@
+import { Badge, Grid, Icon, Skeleton, Text } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+
+
+
+
+
+
+
+
+
+
+
+ !}
+ >
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ !}
+ >
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/badge/color.js b/packages/react-docs/pages/components/badge/color.js
new file mode 100644
index 0000000000..6cd73d8765
--- /dev/null
+++ b/packages/react-docs/pages/components/badge/color.js
@@ -0,0 +1,34 @@
+import { Badge, Grid, Skeleton } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => {
+ const colors = [
+ 'red:60',
+ 'orange:50',
+ 'yellow:50',
+ 'green:60',
+ 'blue:60',
+ 'gray:60',
+ 'magenta:60',
+ 'purple:60',
+ 'teal:60',
+ 'cyan:60',
+ ];
+
+ return (
+
+ {colors.map(color => (
+
+
+
+ ))}
+
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/badge/customization.js b/packages/react-docs/pages/components/badge/customization.js
new file mode 100644
index 0000000000..85e3c56619
--- /dev/null
+++ b/packages/react-docs/pages/components/badge/customization.js
@@ -0,0 +1,62 @@
+import { Badge, Grid, Skeleton, Text, useColorMode } from '@tonic-ui/react';
+import React from 'react';
+
+const OutlineBadge = (props) => {
+ const [colorMode] = useColorMode();
+ const backgroundColor = {
+ dark: 'gray:100',
+ light: 'white',
+ }[colorMode];
+ const borderColor = {
+ dark: 'yellow:50',
+ light: 'yellow:50',
+ }[colorMode];
+ const borderStyle = 'solid';
+ const borderWidth = '2px';
+ const color = {
+ dark: 'white:primary',
+ light: 'black:primary',
+ }[colorMode];
+ const height = '5x';
+ const minWidth = '5x';
+
+ return (
+
+ );
+};
+
+const App = () => {
+ return (
+
+
+
+
+
+
+
+ !}
+ >
+
+
+
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/badge/dot.js b/packages/react-docs/pages/components/badge/dot.js
new file mode 100644
index 0000000000..47fc2a74b0
--- /dev/null
+++ b/packages/react-docs/pages/components/badge/dot.js
@@ -0,0 +1,18 @@
+import { Badge, Icon, Stack } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+
+
+
+
+
+
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/badge/index.page.mdx b/packages/react-docs/pages/components/badge/index.page.mdx
new file mode 100644
index 0000000000..99830013de
--- /dev/null
+++ b/packages/react-docs/pages/components/badge/index.page.mdx
@@ -0,0 +1,71 @@
+# Badge
+
+Badges are used to highlight an item's status for quick recognition.
+
+## Import
+
+```js
+import { Badge } from '@tonic-ui/react';
+```
+
+## Usage
+
+### Basic badge
+
+To display the badge on the top-right corner of the wrapped component, specify the `badgeContent` prop with the desired content.
+
+{render('./basic')}
+
+### Dot badge
+
+Use `variant="dot"` to change a badge into a small dot. This can be used as a notification that something has changed without giving a count.
+
+{render('./dot')}
+
+### Standalone badge
+
+The badge can be used as a standalone component. This can be useful for displaying a badge without a surrounding element.
+
+{render('./standalone')}
+
+### Badge alignment
+
+You can use the `placement` prop to move the badge to any corner of the wrapped element. The default placement is `top-right`. The `placement` prop can be one of `top-left`, `top-right`, `bottom-left`, `bottom-right`.
+
+{render('./badge-alignment')}
+
+### Badge visibility
+
+The badge visibility can be controlled using the `isInvisible` prop.
+
+{render('./badge-visibility')}
+
+### Color
+
+The color of the badge can be changed by passing the `backgroundColor` prop. See the [colors](../theme/colors) section to learn more about colors.
+
+{render('./color')}
+
+### Size
+
+The size of the badge can be changed by passing the `height` and `minWidth` props.
+
+{render('./size')}
+
+### Customization
+
+You can customize the badge style by passing style props. See the following example to learn how to create a outline badge.
+
+{render('./customization')}
+
+## Props
+
+### Badge
+
+| Name | Type | Default | Description |
+| :--- | :--- | :------ | :---------- |
+| children | ReactNode | | |
+| badgeContent | ReactNode \| number \| string | | The badge content. |
+| isInvisible | boolean | | Whether the badge is invisible. |
+| placement | string | 'top-right' | The placement of the badge. One of: 'top-left', 'top-right', 'bottom-left', 'bottom-right'. |
+| variant | string | 'solid' | One of: 'solid', 'dot' |
diff --git a/packages/react-docs/pages/components/badge/size.js b/packages/react-docs/pages/components/badge/size.js
new file mode 100644
index 0000000000..d55d815a63
--- /dev/null
+++ b/packages/react-docs/pages/components/badge/size.js
@@ -0,0 +1,18 @@
+import { Badge, Skeleton, Stack } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+
+
+
+
+
+
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/badge/standalone.js b/packages/react-docs/pages/components/badge/standalone.js
new file mode 100644
index 0000000000..f61b1ecfc0
--- /dev/null
+++ b/packages/react-docs/pages/components/badge/standalone.js
@@ -0,0 +1,14 @@
+import { Badge, Icon, Stack } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+
+
+
+ } height="6x" />
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/box.page.mdx b/packages/react-docs/pages/components/box/index.page.mdx
similarity index 60%
rename from packages/react-docs/pages/components/box.page.mdx
rename to packages/react-docs/pages/components/box/index.page.mdx
index f8263c68d2..0b2ed86a99 100644
--- a/packages/react-docs/pages/components/box.page.mdx
+++ b/packages/react-docs/pages/components/box/index.page.mdx
@@ -14,11 +14,7 @@ import { Box } from '@tonic-ui/react';
By default, the `Box` component renders a `div` element. There might be cases where you want to render a different element, you can use the `as` prop to do that.
-```jsx expanded
-
- Button
-
-```
+{render('./using-the-as-prop')}
### Using style props
@@ -26,21 +22,7 @@ Style props provide a way to use CSS-in-JS styling technique to pass styles as p
You can see the [Style Props](../styled-system/style-props) page to learn how to use style props.
-```jsx expanded
-
- Button
-
-```
+{render('./using-style-props')}
### Using pseudo style props
@@ -48,51 +30,11 @@ Styling elements with [pseudo-classes](https://developer.mozilla.org/en-US/docs/
You can see the [Pseudo Styled Props](../styled-system/pseudo-style-props) page to learn how to use pseudo style props.
-```jsx expanded
-
- Button
-
-```
+{render('./using-pseudo-style-props')}
### Using the `sx` prop
-```jsx expanded
-
- Button
-
-```
+{render('./using-the-sx-prop')}
Read more on [the sx prop](../getting-started/the-sx-prop) page.
diff --git a/packages/react-docs/pages/components/box/using-pseudo-style-props.js b/packages/react-docs/pages/components/box/using-pseudo-style-props.js
new file mode 100644
index 0000000000..0d09511305
--- /dev/null
+++ b/packages/react-docs/pages/components/box/using-pseudo-style-props.js
@@ -0,0 +1,26 @@
+import { Box } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+ Button
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/box/using-style-props.js b/packages/react-docs/pages/components/box/using-style-props.js
new file mode 100644
index 0000000000..cf66b144a4
--- /dev/null
+++ b/packages/react-docs/pages/components/box/using-style-props.js
@@ -0,0 +1,20 @@
+import { Box } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+ Button
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/box/using-the-as-prop.js b/packages/react-docs/pages/components/box/using-the-as-prop.js
new file mode 100644
index 0000000000..cbefcb19f0
--- /dev/null
+++ b/packages/react-docs/pages/components/box/using-the-as-prop.js
@@ -0,0 +1,10 @@
+import { Box } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+ Button
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/box/using-the-sx-prop.js b/packages/react-docs/pages/components/box/using-the-sx-prop.js
new file mode 100644
index 0000000000..72d76101d9
--- /dev/null
+++ b/packages/react-docs/pages/components/box/using-the-sx-prop.js
@@ -0,0 +1,26 @@
+import { Button } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+ Button
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/button-base/disabled.js b/packages/react-docs/pages/components/button-base/attribute-disabled.js
similarity index 100%
rename from packages/react-docs/pages/components/button-base/disabled.js
rename to packages/react-docs/pages/components/button-base/attribute-disabled.js
diff --git a/packages/react-docs/pages/components/button-base/index.page.mdx b/packages/react-docs/pages/components/button-base/index.page.mdx
index a43c34b01d..11812d92f2 100644
--- a/packages/react-docs/pages/components/button-base/index.page.mdx
+++ b/packages/react-docs/pages/components/button-base/index.page.mdx
@@ -18,7 +18,7 @@ Standard button attributes are supported, e.g., `type`, `disabled`, etc.
#### `disabled`
-{render('./disabled')}
+{render('./attribute-disabled')}
### Icon button
diff --git a/packages/react-docs/pages/components/checkbox-group.page.mdx b/packages/react-docs/pages/components/checkbox-group.page.mdx
deleted file mode 100644
index daf063787d..0000000000
--- a/packages/react-docs/pages/components/checkbox-group.page.mdx
+++ /dev/null
@@ -1,194 +0,0 @@
-# CheckboxGroup
-
-`CheckboxGroup` is used to group related checkboxes.
-
-## Import
-
-```js
-import { CheckboxGroup } from '@tonic-ui/react';
-```
-
-### Usage
-
-#### Uncontrolled checkbox group
-
-```jsx
-
-
- Apple
- Orange
- Papaya
-
-
-```
-
-#### Controlled checkbox group
-
-```jsx
-function Example() {
- const [value, setValue] = React.useState(['apple']);
-
- return (
- setValue(value)}>
-
- Apple
- Orange
- Papaya
-
-
- );
-}
-```
-
-### Group orientation
-
-Make a set of checkboxes appear horizontal stacked rather than vertically, by adding `flexDirection="row"` to the `Stack` component.
-
-```jsx
-
-
- Apple
- Orange
- Papaya
-
-
-```
-
-### Colors
-
-Use the `variantColor` prop to change the color scheme of the Radio. `variantColor` can be any color key with key `50`(hover), `60`(checked) that exist in the `theme.colors`.
-
-```jsx
-
-
- Apple
- Orange
- Papaya
-
-
-```
-
-### Sizes
-
-Use the `size` prop to change the size of the `CheckboxGroup`. You can set the value to `sm`, `md`, or `lg`.
-
-```jsx
-
-
-
- Apple
- Orange
- Papaya
-
-
-
-
- Apple
- Orange
- Papaya
-
-
-
-
- Apple
- Orange
- Papaya
-
-
-
-```
-
-### States
-
-```jsx
-
-
-
- Apple
- Orange
- Papaya
-
-
-
-
- Apple
- Orange
- Papaya
-
-
-
-```
-
-### Asynchronous data loading
-
-```jsx
-function Example() {
- const [state, setState] = React.useState({
- state: 'idle',
- fruits: [],
- });
- const timerRef = React.useRef(null);
- const fetchData = React.useCallback(() => {
- setState(prevState => ({ ...prevState, state: 'loading' }));
-
- if (timerRef.current) {
- clearTimeout(timerRef.current);
- timerRef.current = null;
- }
- timerRef.current = setTimeout(() => {
- setState({
- state: 'success',
- fruits: ['apple'],
- });
-
- timerRef.current = null;
- }, 2000);
- }, []);
-
- React.useEffect(() => {
- fetchData();
- }, [fetchData]);
-
- return (
- <>
-
- fetchData()}>
-
-
-
- Reload
-
-
-
- {
- setState(prevState => ({ ...prevState, fruits: value }));
- }}
- >
-
- Apple
- Orange
- Papaya
-
-
- >
- );
-}
-```
-
-## Props
-
-### CheckboxGroup
-
-| Name | Type | Default | Description |
-| :--- | :--- | :------ | :---------- |
-| children | ReactNode \| `(context) => ReactNode` | | A function child can be used intead of a React element. This function is called with the context object. |
-| defaultValue | (string\|number)[] | | The initial value of the checkbox group. |
-| disabled | boolean | false | If `true`, all checkboxes will be disabled. |
-| name | string | | The name used to reference the value of the control. If you don't provide this prop, it falls back to a randomly generated name. |
-| onChange | (event) => void | | A callback fired when any descendant `Checkbox` is checked or unchecked. |
-| size | string | 'md' | The size (width and height) of the checkbox. One of: 'sm', 'md', 'lg' |
-| value | (string\|number)[] | | The value of the checkbox group. |
-| variantColor | string | | The color of the checkbox when it's checked. This should be one of the color keys in the theme (e.g. 'green', 'red') |
diff --git a/packages/react-docs/pages/components/checkbox-group/asynchronous-data-loading.js b/packages/react-docs/pages/components/checkbox-group/asynchronous-data-loading.js
new file mode 100644
index 0000000000..a3a12a4bd8
--- /dev/null
+++ b/packages/react-docs/pages/components/checkbox-group/asynchronous-data-loading.js
@@ -0,0 +1,59 @@
+import { Box, Checkbox, CheckboxGroup, Flex, Icon, LinkButton, Space, Stack } from '@tonic-ui/react';
+import React, { useCallback, useEffect, useRef, useState } from 'react';
+
+const App = () => {
+ const [state, setState] = useState({
+ state: 'idle',
+ fruits: [],
+ });
+ const timerRef = useRef(null);
+ const fetchData = useCallback(() => {
+ setState(prevState => ({ ...prevState, state: 'loading' }));
+
+ if (timerRef.current) {
+ clearTimeout(timerRef.current);
+ timerRef.current = null;
+ }
+ timerRef.current = setTimeout(() => {
+ setState({
+ state: 'success',
+ fruits: ['apple'],
+ });
+
+ timerRef.current = null;
+ }, 2000);
+ }, []);
+
+ useEffect(() => {
+ fetchData();
+ }, [fetchData]);
+
+ return (
+ <>
+
+ fetchData()}>
+
+
+
+ Reload
+
+
+
+ {
+ setState(prevState => ({ ...prevState, fruits: value }));
+ }}
+ >
+
+ Apple
+ Orange
+ Papaya
+
+
+ >
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/checkbox-group/colors.js b/packages/react-docs/pages/components/checkbox-group/colors.js
new file mode 100644
index 0000000000..3fc54dc435
--- /dev/null
+++ b/packages/react-docs/pages/components/checkbox-group/colors.js
@@ -0,0 +1,14 @@
+import { Checkbox, CheckboxGroup, Stack } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+ Apple
+ Orange
+ Papaya
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/checkbox-group/controlled-checkbox-group.js b/packages/react-docs/pages/components/checkbox-group/controlled-checkbox-group.js
new file mode 100644
index 0000000000..9dc88613bd
--- /dev/null
+++ b/packages/react-docs/pages/components/checkbox-group/controlled-checkbox-group.js
@@ -0,0 +1,18 @@
+import { Checkbox, CheckboxGroup, Stack } from '@tonic-ui/react';
+import React, { useState } from 'react';
+
+const App = () => {
+ const [value, setValue] = useState(['apple']);
+
+ return (
+ setValue(value)}>
+
+ Apple
+ Orange
+ Papaya
+
+
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/checkbox-group/group-orientation.js b/packages/react-docs/pages/components/checkbox-group/group-orientation.js
new file mode 100644
index 0000000000..f86e4ed25e
--- /dev/null
+++ b/packages/react-docs/pages/components/checkbox-group/group-orientation.js
@@ -0,0 +1,14 @@
+import { Checkbox, CheckboxGroup, Stack } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+ Apple
+ Orange
+ Papaya
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/checkbox-group/index.page.mdx b/packages/react-docs/pages/components/checkbox-group/index.page.mdx
new file mode 100644
index 0000000000..52e293da7d
--- /dev/null
+++ b/packages/react-docs/pages/components/checkbox-group/index.page.mdx
@@ -0,0 +1,60 @@
+# CheckboxGroup
+
+`CheckboxGroup` is used to group related checkboxes.
+
+## Import
+
+```js
+import { CheckboxGroup } from '@tonic-ui/react';
+```
+
+### Usage
+
+#### Uncontrolled checkbox group
+
+{render('./uncontrolled-checkbox-group')}
+
+#### Controlled checkbox group
+
+{render('./controlled-checkbox-group')}
+
+### Group orientation
+
+Make a set of checkboxes appear horizontal stacked rather than vertically, by adding `flexDirection="row"` to the `Stack` component.
+
+{render('./group-orientation')}
+
+### Colors
+
+Use the `variantColor` prop to change the color scheme of the Radio. `variantColor` can be any color key with key `50`(hover), `60`(checked) that exist in the `theme.colors`.
+
+{render('./colors')}
+
+### Sizes
+
+Use the `size` prop to change the size of the `CheckboxGroup`. You can set the value to `sm`, `md`, or `lg`.
+
+{render('./sizes')}
+
+### States
+
+{render('./states')}
+
+### Asynchronous data loading
+
+{render('./asynchronous-data-loading')}
+
+## Props
+
+### CheckboxGroup
+
+| Name | Type | Default | Description |
+| :--- | :--- | :------ | :---------- |
+| children | ReactNode \| `(context) => ReactNode` | | A function child can be used intead of a React element. This function is called with the context object. |
+| defaultValue | (string\|number)[] | | The initial value of the checkbox group. |
+| disabled | boolean | false | If `true`, all checkboxes will be disabled. |
+| name | string | | The name used to reference the value of the control. If you don't provide this prop, it falls back to a randomly generated name. |
+| onChange | (event) => void | | A callback fired when any descendant `Checkbox` is checked or unchecked. |
+| size | string | 'md' | The size (width and height) of the checkbox. One of: 'sm', 'md', 'lg' |
+| value | (string\|number)[] | | The value of the checkbox group. |
+| variantColor | string | | The color of the checkbox when it's checked. This should be one of the color keys in the theme (e.g. 'green', 'red') |
diff --git a/packages/react-docs/pages/components/checkbox-group/sizes.js b/packages/react-docs/pages/components/checkbox-group/sizes.js
new file mode 100644
index 0000000000..73fcde4e1a
--- /dev/null
+++ b/packages/react-docs/pages/components/checkbox-group/sizes.js
@@ -0,0 +1,30 @@
+import { Checkbox, CheckboxGroup, Stack } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+
+ Apple
+ Orange
+ Papaya
+
+
+
+
+ Apple
+ Orange
+ Papaya
+
+
+
+
+ Apple
+ Orange
+ Papaya
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/checkbox-group/states.js b/packages/react-docs/pages/components/checkbox-group/states.js
new file mode 100644
index 0000000000..5b762d552f
--- /dev/null
+++ b/packages/react-docs/pages/components/checkbox-group/states.js
@@ -0,0 +1,23 @@
+import { Checkbox, CheckboxGroup, Stack } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+
+ Apple
+ Orange
+ Papaya
+
+
+
+
+ Apple
+ Orange
+ Papaya
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/checkbox-group/uncontrolled-checkbox-group.js b/packages/react-docs/pages/components/checkbox-group/uncontrolled-checkbox-group.js
new file mode 100644
index 0000000000..bc4cabf7fb
--- /dev/null
+++ b/packages/react-docs/pages/components/checkbox-group/uncontrolled-checkbox-group.js
@@ -0,0 +1,14 @@
+import { Checkbox, CheckboxGroup, Stack } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+ Apple
+ Orange
+ Papaya
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/checkbox/accessibility.js b/packages/react-docs/pages/components/checkbox/accessibility.js
new file mode 100644
index 0000000000..06f4637e2e
--- /dev/null
+++ b/packages/react-docs/pages/components/checkbox/accessibility.js
@@ -0,0 +1,13 @@
+import { Checkbox } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+);
+
+export default App;
\ No newline at end of file
diff --git a/packages/react-docs/pages/components/checkbox/basic.js b/packages/react-docs/pages/components/checkbox/basic.js
new file mode 100644
index 0000000000..5fc9970f47
--- /dev/null
+++ b/packages/react-docs/pages/components/checkbox/basic.js
@@ -0,0 +1,10 @@
+import { Checkbox } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+ Label
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/checkbox/colors.js b/packages/react-docs/pages/components/checkbox/colors.js
new file mode 100644
index 0000000000..9e361850df
--- /dev/null
+++ b/packages/react-docs/pages/components/checkbox/colors.js
@@ -0,0 +1,15 @@
+import { Checkbox, Flex } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+ Label
+
+
+ Label
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/checkbox/faq-input-ref.js b/packages/react-docs/pages/components/checkbox/faq-input-ref.js
new file mode 100644
index 0000000000..f15b3fdc1a
--- /dev/null
+++ b/packages/react-docs/pages/components/checkbox/faq-input-ref.js
@@ -0,0 +1,23 @@
+import { Button, Checkbox, Flex } from '@tonic-ui/react';
+import React, { useCallback, useRef } from 'react';
+
+const App = () => {
+ const inputRef = useRef();
+ const handleClick = useCallback(() => {
+ inputRef.current.focus();
+ console.log(inputRef.current.checked); // => true
+ }, []);
+
+ return (
+
+
+ Label
+
+
+ Click Me
+
+
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/checkbox/flex-container.js b/packages/react-docs/pages/components/checkbox/flex-container.js
new file mode 100644
index 0000000000..120fe3d022
--- /dev/null
+++ b/packages/react-docs/pages/components/checkbox/flex-container.js
@@ -0,0 +1,23 @@
+import { Box, Checkbox, Flex, Text } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+
+
+
+ Label
+ Helper text
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/checkbox/indeterminate.js b/packages/react-docs/pages/components/checkbox/indeterminate.js
new file mode 100644
index 0000000000..d97f26b300
--- /dev/null
+++ b/packages/react-docs/pages/components/checkbox/indeterminate.js
@@ -0,0 +1,36 @@
+import { Checkbox, Stack } from '@tonic-ui/react';
+import React, { useState } from 'react';
+
+const App = () => {
+ const [checkedItems, setCheckedItems] = useState([true, false]);
+ const allChecked = checkedItems.every(Boolean);
+ const isIndeterminate = checkedItems.some(Boolean) && !allChecked;
+
+ return (
+ <>
+ setCheckedItems([e.target.checked, e.target.checked])}
+ >
+ Parent
+
+
+ setCheckedItems([e.target.checked, checkedItems[1]])}
+ >
+ Child 1
+
+ setCheckedItems([checkedItems[0], e.target.checked])}
+ >
+ Child 2
+
+
+ >
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/checkbox.page.mdx b/packages/react-docs/pages/components/checkbox/index.page.mdx
similarity index 60%
rename from packages/react-docs/pages/components/checkbox.page.mdx
rename to packages/react-docs/pages/components/checkbox/index.page.mdx
index 068547a974..a1c0ae4be9 100644
--- a/packages/react-docs/pages/components/checkbox.page.mdx
+++ b/packages/react-docs/pages/components/checkbox/index.page.mdx
@@ -12,130 +12,31 @@ import { Checkbox } from '@tonic-ui/react';
## Usage
-```jsx
-
- Label
-
-```
+{render('./basic')}
You can use a flex container to align a checkbox with other components. This allows you to easily control the positioning and spacing of all elements within the container.
-```jsx
-
-
-
-
-
- Label
- Helper text
-
-
-```
+{render('./flex-container')}
### Colors
Use the `variantColor` prop to change the color scheme of the checkbox. `variantColor` can be any color key with key `50` (hover) or `60` (checked, active) that exist in `theme.colors`.
-```jsx
-
-
- Label
-
-
- Label
-
-
-```
+{render('./colors')}
### Sizes
Use the `size` prop to change the size of the checkbox. You can set the value to `sm`, `md`, or `lg`.
-```jsx
-
-
- Label
-
-
- Label
-
-
- Label
-
-
-```
+{render('./sizes')}
### States
-```jsx
-
-
-
- Label
-
-
- Label
-
-
- Label
-
-
-
-
- Label
-
-
- Label
-
-
- Label
-
-
-
-```
+{render('./states')}
### Indeterminate
-```jsx
-function IndeterminateExample() {
- const [checkedItems, setCheckedItems] = React.useState([true, false]);
- const allChecked = checkedItems.every(Boolean);
- const isIndeterminate = checkedItems.some(Boolean) && !allChecked;
-
- return (
- <>
- setCheckedItems([e.target.checked, e.target.checked])}
- >
- Parent
-
-
- setCheckedItems([e.target.checked, checkedItems[1]])}
- >
- Child 1
-
- setCheckedItems([checkedItems[0], e.target.checked])}
- >
- Child 2
-
-
- >
- );
-}
-```
+{render('./indeterminate')}
## Accessibility
@@ -162,27 +63,7 @@ Once you have obtained the reference to the input element, you can access its pr
Here's an example of how you can utilize the `inputRef` prop to access the input element and perform actions:
-```jsx
-function Example() {
- const inputRef = React.useRef();
-
- const handleClick = () => {
- inputRef.current.focus();
- console.log(inputRef.current.checked); // => true
- };
-
- return (
-
-
- Label
-
-
- Click Me
-
-
- );
-}
-```
+{render('./faq-input-ref')}
## Props
diff --git a/packages/react-docs/pages/components/checkbox/sizes.js b/packages/react-docs/pages/components/checkbox/sizes.js
new file mode 100644
index 0000000000..0f9af9081d
--- /dev/null
+++ b/packages/react-docs/pages/components/checkbox/sizes.js
@@ -0,0 +1,18 @@
+import { Checkbox, Flex } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+ Label
+
+
+ Label
+
+
+ Label
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/checkbox/states.js b/packages/react-docs/pages/components/checkbox/states.js
new file mode 100644
index 0000000000..8592fa37f0
--- /dev/null
+++ b/packages/react-docs/pages/components/checkbox/states.js
@@ -0,0 +1,31 @@
+import { Checkbox, Flex, Stack } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+
+ Label
+
+
+ Label
+
+
+ Label
+
+
+
+
+ Label
+
+
+ Label
+
+
+ Label
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/code/basic.js b/packages/react-docs/pages/components/code/basic.js
new file mode 100644
index 0000000000..5630e8fa26
--- /dev/null
+++ b/packages/react-docs/pages/components/code/basic.js
@@ -0,0 +1,8 @@
+import { Code } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+ Hello World
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/code.page.mdx b/packages/react-docs/pages/components/code/index.page.mdx
similarity index 90%
rename from packages/react-docs/pages/components/code.page.mdx
rename to packages/react-docs/pages/components/code/index.page.mdx
index 390df2d35e..4f74733ae1 100644
--- a/packages/react-docs/pages/components/code.page.mdx
+++ b/packages/react-docs/pages/components/code/index.page.mdx
@@ -10,9 +10,7 @@ import { Code } from '@tonic-ui/react';
## Usage
-```jsx
-Hello World
-```
+{render('./basic')}
## Props
diff --git a/packages/react-docs/pages/components/control-box.page.mdx b/packages/react-docs/pages/components/control-box.page.mdx
deleted file mode 100644
index 82f9e2bf77..0000000000
--- a/packages/react-docs/pages/components/control-box.page.mdx
+++ /dev/null
@@ -1,116 +0,0 @@
-# ControlBox
-
-`ControlBox` provides style props to change it's styles based on a sibling `checkbox` or `radio` input. It relies on a [common CSS technique](https://dev.to/lkopacz/create-custom-keyboard-accessible-checkboxes-2036) for styling custom controls.
-
-For this component to work, it should have a sibling `input` and be contained in a `label`.
-
-## Usage
-
-### Creating a custom checkbox
-
-```jsx
-
-
-
-
-
-
-
- Checkbox
-
-
-```
-
-### Creating a custom radio button
-
-```jsx
-
-
-
-
-
-
-
- Radio Button
-
-
-```
-
-## Props
-
-### ControlBox
-
-By default, it toggles the opacity of the `ControlBox` children by setting `_child` to `{ opacity: 0 }` and `_checkedAndChild` to `{ opacity: 1 }`.
-
-| Name | Selector | Description |
-| :--- | :----------- | :---------- |
-| \_child | `[input] + & > *` | Styles for the child of the `ControlBox`. |
-| \_disabled | `[input]:disabled + &` | Styles for when the sibling `input` is disabled. |
-| \_focus | `[input]:focus + &` | Styles for when the sibling `input` is focused. |
-| \_hover | `[input]:hover:not(:disabled):not(:checked):not(:focus) + &` | Styles for when the sibling `input` is hovered. |
-| \_checked | `[input]:checked + &` | Styles for when the sibling `input` is checked. |
-| \_checkedAndActive | `[input]:checked:active:not(:disabled):not(:focus) + &` | Styles for when the sibling `input` is checked and actived. |
-| \_checkedAndChild | `[input]:checked + & > *` | Styles for the child of the `ControlBox` when the sibling `input` is checked. |
-| \_checkedAndDisabled | `[input]:checked:disabled + &` | Styles for when the sibling `input` is checked and disabled. |
-| \_checkedAndFocus | `[input]:checked:focus + &` | Styles for when the sibling `input` is checked and focused. |
-| \_checkedAndHover | `[input]:checked:hover:not(:disabled):not(:focus) + &` | Styles for when the sibling `input` is checked and hovered. |
-| \_indeterminate | `[input][data-indeterminate=true] + &` | Styles for when the sibling `input` is indeterminate. |
-| \_indeterminateAndActive | `[input][data-indeterminate=true]:active:not(:disabled):not(:focus) + &` | Styles for when the sibling `input` is indeterminate and actived. |
-| \_indeterminateAndChild | `[input][data-indeterminate=true] + & > *` | Styles for the child of the `ControlBox` when the sibling `input` is indeterminate. |
-| \_indeterminateAndDisabled | `[input][data-indeterminate=true]:disabled + &` | Styles for when the sibling `input` is indeterminate and disabled. |
-| \_indeterminateAndFocus | `[input][data-indeterminate=true]:focus + &` | Styles for when the sibling `input` is indeterminate and focused. |
-| \_indeterminateAndHover | `[input][data-indeterminate=true]:hover:not(:disabled):not(:focus) + &` | Styles for when the sibling `input` is indeterminate and hovered. |
diff --git a/packages/react-docs/pages/components/css-baseline.page.mdx b/packages/react-docs/pages/components/css-baseline/index.page.mdx
similarity index 100%
rename from packages/react-docs/pages/components/css-baseline.page.mdx
rename to packages/react-docs/pages/components/css-baseline/index.page.mdx
diff --git a/packages/react-docs/pages/components/divider/basic.js b/packages/react-docs/pages/components/divider/basic.js
new file mode 100644
index 0000000000..f887223f02
--- /dev/null
+++ b/packages/react-docs/pages/components/divider/basic.js
@@ -0,0 +1,8 @@
+import { Divider } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+);
+
+export default App;
\ No newline at end of file
diff --git a/packages/react-docs/pages/components/divider/composition.js b/packages/react-docs/pages/components/divider/composition.js
new file mode 100644
index 0000000000..96e571f025
--- /dev/null
+++ b/packages/react-docs/pages/components/divider/composition.js
@@ -0,0 +1,14 @@
+import { Divider, Flex, Icon } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+
+
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/divider/horizontal-orientation.js b/packages/react-docs/pages/components/divider/horizontal-orientation.js
new file mode 100644
index 0000000000..781470b50d
--- /dev/null
+++ b/packages/react-docs/pages/components/divider/horizontal-orientation.js
@@ -0,0 +1,12 @@
+import { Divider, Stack } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/divider.page.mdx b/packages/react-docs/pages/components/divider/index.page.mdx
similarity index 50%
rename from packages/react-docs/pages/components/divider.page.mdx
rename to packages/react-docs/pages/components/divider/index.page.mdx
index a3706636fa..f3bf5009c4 100644
--- a/packages/react-docs/pages/components/divider.page.mdx
+++ b/packages/react-docs/pages/components/divider/index.page.mdx
@@ -12,43 +12,21 @@ import { Divider } from '@tonic-ui/react';
The `Divider` renders a thin line vertically or horizontally.
-```jsx
-
-```
+{render('./basic')}
### Orientation
Pass the `orientation` prop and set it to either `horizontal` or `vertical`.
-```jsx
-
-
-
-
-
-```
+{render('./horizontal-orientation')}
If the vertical orientation is used, make sure that the parent element is assigned a height.
-```jsx
-
-
-
-
-
-```
+{render('./vertical-orientation')}
-## Composition
+### Composition
-```jsx
-
-
-
-
-
-
-
-```
+{render('./composition')}
## Props
diff --git a/packages/react-docs/pages/components/divider/vertical-orientation.js b/packages/react-docs/pages/components/divider/vertical-orientation.js
new file mode 100644
index 0000000000..2cb50e5244
--- /dev/null
+++ b/packages/react-docs/pages/components/divider/vertical-orientation.js
@@ -0,0 +1,12 @@
+import { Divider, Stack } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/flex.page.mdx b/packages/react-docs/pages/components/flex.page.mdx
deleted file mode 100644
index d3f8a6d5ae..0000000000
--- a/packages/react-docs/pages/components/flex.page.mdx
+++ /dev/null
@@ -1,225 +0,0 @@
-# Flex
-
-`Flex` is a [`Box`](box) with `display: flex` and comes with helpful style shorthand props.
-
-## Import
-
-```js
-import { Flex } from '@tonic-ui/react';
-```
-
-## Usage
-
-Flex provides the following style shorthand props:
-
-| Shorthand Prop | Style Prop | CSS Property | Description |
-| :------------- | :--------- | :----------- | :---------- |
-| align | alignItems | [align-items](https://developer.mozilla.org/en-US/docs/Web/CSS/align-items) | Sets the `align-self` value on all direct children as a group. |
-| direction | flexDirection | [flex-direction](https://developer.mozilla.org/en-US/docs/Web/CSS/flex-direction) | Sets how flex items are placed in the flex container. |
-| wrap | flexWrap | [flex-wrap](https://developer.mozilla.org/en-US/docs/Web/CSS/flex-wrap) | Sets whether flex items are forced onto one line or can wrap onto multiple lines. |
-| justify | justifyContent | [justify-content](https://developer.mozilla.org/en-US/docs/Web/CSS/justify-content) | Defines how the browser distributes space between and around content items along the main axis of a flex container. |
-
-### Flex items
-
-You can use the `flex` property to set how a flex item will grow or shrink to fit the available space in its flex container. It is a shorthand for `flex-grow`, `flex-shrink`, and `flex-basis`. For most purposes, you should set `flex` to one of the following values: `auto`, `initial`, `none`, or a positive unitless number.
-
-#### Values
-
-##### `initial`
-The item is sized according to its `width` and `height` properties. It shrinks to its minimum size to fit the container, but does not grow to absorb any extra free space in the flex container. This is equivalent to setting `flex: 0 1 auto`.
-
-##### `auto`
-The item is sized according to its `width` and `height` properties, but grows to absorb any extra free space in the flex container, and shrinks to its minimum size to fit the container. This is equivalent to setting `flex: 1 1 auto`.
-
-##### `none`
-The item is sized according to its `width` and `height` properties. It is fully inflexible: it neither shrinks nor grows in relation to the flex container. This is equivalent to setting `flex: 0 0 auto`.
-
-To see the effect of these values, try resizing the flex containers below:
-
-```jsx noInline
-const FlexItem = (props) => (
-
-);
-
-function Example() {
- return (
- <>
-
- auto
- auto
- auto
-
-
- auto
- initial
- initial
-
-
- auto
- auto
- none
-
-
- initial
- none
- none
-
-
- 4
- 2
- 1
-
- >
- );
-}
-
-render( );
-```
-
-### The `flexDirection` property
-
-```jsx noInline
-const FlexItem = (props) => (
-
-);
-
-function Example() {
- const [value, setValue] = React.useState('row');
-
- return (
- <>
-
- setValue('row')}>row
- setValue('row-reverse')}>row-reverse
- setValue('column')}>column
- setValue('column-reverse')}>column-reverse
-
-
- {``}
-
-
- One
- Two
- Three
-
- >
- );
-}
-
-render( );
-```
-
-### The `flexWrap` property
-
-```jsx noInline
-const FlexItem = (props) => (
-
-);
-
-function Example() {
- const [value, setValue] = React.useState('nowrap');
-
- return (
- <>
-
- setValue('nowrap')}>nowrap
- setValue('wrap')}>wrap
- setValue('wrap-reverse')}>wrap-reverse
-
-
- {``}
-
-
- One
- Two
- Three
- Four
- Five
- Six
-
- >
- );
-}
-
-render( );
-```
-
-### The `alignItems` property
-
-```jsx noInline
-const FlexItem = (props) => (
-
-);
-
-function Example() {
- const [value, setValue] = React.useState('stretch');
-
- return (
- <>
-
- setValue('stretch')}>stretch
- setValue('flex-start')}>flex-start
- setValue('center')}>center
- setValue('flex-end')}>flex-end
-
-
- {``}
-
-
- One
- Two
- Three
-
- >
- );
-}
-
-render( );
-```
-
-### The `justifyContent` property
-
-```jsx noInline
-const FlexItem = (props) => (
-
-);
-
-function Example() {
- const [value, setValue] = React.useState('start');
-
- return (
- <>
-
- setValue('flex-start')}>flex-start
- setValue('center')}>center
- setValue('flex-end')}>flex-end
- setValue('space-between')}>space-between
- setValue('space-around')}>space-around
- setValue('space-evenly')}>space-evenly
-
-
- {``}
-
-
- One
- Two
- Three
-
- >
- );
-}
-
-render( );
-```
-
-## Props
-
-### Flex
-
-| Name | Type | Default | Description |
-| :--- | :--- | :------ | :---------- |
-| children | ReactNode | | |
-| align | string | | A shorthand of the `alignItems` property that sets the alignment of flex items along the cross-axis of the flex container. Valid values include `flex-start`, `flex-end`, `center`, `baseline`, and `stretch`. |
-| direction | string | | A shorthand of the `flexDirection` property that sets how flex items are placed in the flex container. Valid values include `row`, `row-reverse`, `column`, and `column-reverse`. |
-| wrap | string | | A shorthand of the `flexWrap` property that sets whether flex items are forced onto one line or can wrap onto multiple lines. Valid values include `nowrap`, `wrap`, and `wrap-reverse`. |
-| justify | string | | A shorthand of the `justifyContent` property that defines how the browser distributes space between and around content items along themain axis of a flex container. Valid values include `flex-start`, `flex-end`, `center`, `space-between`, `space-around`, and `space-evenly`. |
diff --git a/packages/react-docs/pages/components/flex/align-items.js b/packages/react-docs/pages/components/flex/align-items.js
new file mode 100644
index 0000000000..f8bf1abce8
--- /dev/null
+++ b/packages/react-docs/pages/components/flex/align-items.js
@@ -0,0 +1,31 @@
+import { Box, Button, Flex, Stack } from '@tonic-ui/react';
+import React, { useState } from 'react';
+
+const FlexItem = (props) => (
+
+);
+
+const App = () => {
+ const [value, setValue] = useState('stretch');
+
+ return (
+ <>
+
+ setValue('stretch')}>stretch
+ setValue('flex-start')}>flex-start
+ setValue('center')}>center
+ setValue('flex-end')}>flex-end
+
+
+ {``}
+
+
+ One
+ Two
+ Three
+
+ >
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/flex/flex-direction.js b/packages/react-docs/pages/components/flex/flex-direction.js
new file mode 100644
index 0000000000..b8a2ac8e55
--- /dev/null
+++ b/packages/react-docs/pages/components/flex/flex-direction.js
@@ -0,0 +1,31 @@
+import { Box, Button, Flex, Stack } from '@tonic-ui/react';
+import React, { useState } from 'react';
+
+const FlexItem = (props) => (
+
+);
+
+const App = () => {
+ const [value, setValue] = useState('row');
+
+ return (
+ <>
+
+ setValue('row')}>row
+ setValue('row-reverse')}>row-reverse
+ setValue('column')}>column
+ setValue('column-reverse')}>column-reverse
+
+
+ {``}
+
+
+ One
+ Two
+ Three
+
+ >
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/flex/flex-none.js b/packages/react-docs/pages/components/flex/flex-none.js
new file mode 100644
index 0000000000..02eed51264
--- /dev/null
+++ b/packages/react-docs/pages/components/flex/flex-none.js
@@ -0,0 +1,40 @@
+import { Box, Flex } from '@tonic-ui/react';
+import React from 'react';
+
+const FlexItem = (props) => (
+
+);
+
+const App = () => {
+ return (
+ <>
+
+ auto
+ auto
+ auto
+
+
+ auto
+ initial
+ initial
+
+
+ auto
+ auto
+ none
+
+
+ initial
+ none
+ none
+
+
+ 4
+ 2
+ 1
+
+ >
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/flex/flex-wrap.js b/packages/react-docs/pages/components/flex/flex-wrap.js
new file mode 100644
index 0000000000..b25458146f
--- /dev/null
+++ b/packages/react-docs/pages/components/flex/flex-wrap.js
@@ -0,0 +1,33 @@
+import { Box, Button, Flex, Stack } from '@tonic-ui/react';
+import React, { useState } from 'react';
+
+const FlexItem = (props) => (
+
+);
+
+const App = () => {
+ const [value, setValue] = useState('nowrap');
+
+ return (
+ <>
+
+ setValue('nowrap')}>nowrap
+ setValue('wrap')}>wrap
+ setValue('wrap-reverse')}>wrap-reverse
+
+
+ {``}
+
+
+ One
+ Two
+ Three
+ Four
+ Five
+ Six
+
+ >
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/flex/index.page.mdx b/packages/react-docs/pages/components/flex/index.page.mdx
new file mode 100644
index 0000000000..379f3022cd
--- /dev/null
+++ b/packages/react-docs/pages/components/flex/index.page.mdx
@@ -0,0 +1,67 @@
+# Flex
+
+`Flex` is a [`Box`](box) with `display: flex` and comes with helpful style shorthand props.
+
+## Import
+
+```js
+import { Flex } from '@tonic-ui/react';
+```
+
+## Usage
+
+Flex provides the following style shorthand props:
+
+| Shorthand Prop | Style Prop | CSS Property | Description |
+| :------------- | :--------- | :----------- | :---------- |
+| align | alignItems | [align-items](https://developer.mozilla.org/en-US/docs/Web/CSS/align-items) | Sets the `align-self` value on all direct children as a group. |
+| direction | flexDirection | [flex-direction](https://developer.mozilla.org/en-US/docs/Web/CSS/flex-direction) | Sets how flex items are placed in the flex container. |
+| wrap | flexWrap | [flex-wrap](https://developer.mozilla.org/en-US/docs/Web/CSS/flex-wrap) | Sets whether flex items are forced onto one line or can wrap onto multiple lines. |
+| justify | justifyContent | [justify-content](https://developer.mozilla.org/en-US/docs/Web/CSS/justify-content) | Defines how the browser distributes space between and around content items along the main axis of a flex container. |
+
+### Flex items
+
+You can use the `flex` property to set how a flex item will grow or shrink to fit the available space in its flex container. It is a shorthand for `flex-grow`, `flex-shrink`, and `flex-basis`. For most purposes, you should set `flex` to one of the following values: `auto`, `initial`, `none`, or a positive unitless number.
+
+#### Values
+
+##### `initial`
+The item is sized according to its `width` and `height` properties. It shrinks to its minimum size to fit the container, but does not grow to absorb any extra free space in the flex container. This is equivalent to setting `flex: 0 1 auto`.
+
+##### `auto`
+The item is sized according to its `width` and `height` properties, but grows to absorb any extra free space in the flex container, and shrinks to its minimum size to fit the container. This is equivalent to setting `flex: 1 1 auto`.
+
+##### `none`
+The item is sized according to its `width` and `height` properties. It is fully inflexible: it neither shrinks nor grows in relation to the flex container. This is equivalent to setting `flex: 0 0 auto`.
+
+To see the effect of these values, try resizing the flex containers below:
+
+{render('./flex-none')}
+
+### The `flexDirection` property
+
+{render('./flex-direction')}
+
+### The `flexWrap` property
+
+{render('./flex-wrap')}
+
+### The `alignItems` property
+
+{render('./align-items')}
+
+### The `justifyContent` property
+
+{render('./justify-content')}
+
+## Props
+
+### Flex
+
+| Name | Type | Default | Description |
+| :--- | :--- | :------ | :---------- |
+| children | ReactNode | | |
+| align | string | | A shorthand of the `alignItems` property that sets the alignment of flex items along the cross-axis of the flex container. Valid values include `flex-start`, `flex-end`, `center`, `baseline`, and `stretch`. |
+| direction | string | | A shorthand of the `flexDirection` property that sets how flex items are placed in the flex container. Valid values include `row`, `row-reverse`, `column`, and `column-reverse`. |
+| wrap | string | | A shorthand of the `flexWrap` property that sets whether flex items are forced onto one line or can wrap onto multiple lines. Valid values include `nowrap`, `wrap`, and `wrap-reverse`. |
+| justify | string | | A shorthand of the `justifyContent` property that defines how the browser distributes space between and around content items along themain axis of a flex container. Valid values include `flex-start`, `flex-end`, `center`, `space-between`, `space-around`, and `space-evenly`. |
diff --git a/packages/react-docs/pages/components/flex/justify-content.js b/packages/react-docs/pages/components/flex/justify-content.js
new file mode 100644
index 0000000000..61b6fcafe1
--- /dev/null
+++ b/packages/react-docs/pages/components/flex/justify-content.js
@@ -0,0 +1,33 @@
+import { Box, Button, Flex, Stack } from '@tonic-ui/react';
+import React, { useState } from 'react';
+
+const FlexItem = (props) => (
+
+);
+
+const App = () => {
+ const [value, setValue] = useState('start');
+
+ return (
+ <>
+
+ setValue('flex-start')}>flex-start
+ setValue('center')}>center
+ setValue('flex-end')}>flex-end
+ setValue('space-between')}>space-between
+ setValue('space-around')}>space-around
+ setValue('space-evenly')}>space-evenly
+
+
+ {``}
+
+
+ One
+ Two
+ Three
+
+ >
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/grid.page.mdx b/packages/react-docs/pages/components/grid.page.mdx
deleted file mode 100644
index d1cf0a69a7..0000000000
--- a/packages/react-docs/pages/components/grid.page.mdx
+++ /dev/null
@@ -1,543 +0,0 @@
-# Grid
-
-`Grid` is a [`Box`](box) with `display: grid` and comes with helpful style shorthand props.
-
-## Import
-
-```js
-import { Grid } from '@tonic-ui/react';
-```
-
-## Usage
-
-Grid provides the following style shorthand props:
-
-| Shorthand Prop | Style Prop | CSS Property | Description |
-| :------------- | :--------- | :----------- | ----------- |
-| gap | gridGap | [grid-gap](https://developer.mozilla.org/en-US/docs/Web/CSS/gap) | Sets the gaps (gutters) between rows and columns. It is a shorthand for `row-gap` and `column-gap`. |
-| rowGap | gridRowGap | [grid-row-gap](https://developer.mozilla.org/en-US/docs/Web/CSS/row-gap) | Sets the size of the gap (gutter) between an element's grid rows. |
-| columnGap | gridColumnGap | [grid-column-gap](https://developer.mozilla.org/en-US/docs/Web/CSS/column-gap) | Sets the size of the gap (gutter) between an element's columns. |
-| row | gridRow | [grid-row](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-row) | a shorthand property for `grid-row-start` and `grid-row-end`. |
-| column | gridColumn | [grid-column](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-column) | A shorthand property for `grid-column-start` and `grid-column-end`. |
-| area | gridArea | [grid-area](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-area) | A shorthand property for `grid-row-start`, `grid-column-start`, `grid-row-end` and `grid-column-end`. |
-| autoFlow | gridAutoFlow | [grid-auto-flow](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-auto-flow) | Controls how the auto-placement algorithm works. |
-| autoRows | gridAutoRows | [grid-auto-rows](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-auto-rows) | Specifies the size of an implicitly-created grid row track or pattern of tracks. |
-| autoColumns | gridAutoColumns | [grid-auto-columns](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-auto-columns) | Specifies the size of an implicitly-created grid column track or pattern of tracks. |
-| templateRows | gridTemplateRows | [grid-template-rows](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template-rows) | Defines the line names and track sizing functions of the grid rows. |
-| templateColumns | gridTemplateColumns | [grid-template-columns](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template-columns) | Defines the line names and track sizing functions of the grid columns. |
-| templateAreas | gridTemplateAreas | [grid-template-areas](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template-areas) | Specifies named grid areas. |
-
-### The `gap` (`gridGap`) property
-
-```jsx noInline
-const GridItem = (props) => (
-
-);
-
-function Example() {
- const [value, setValue] = React.useState('0');
-
- return (
- <>
-
- setValue('0')}>0
- setValue('10%')}>10%
- setValue('1rem')}>1rem
- setValue('10px 20px')}>10px 20px
- setValue('calc(20px + 10%)')}>calc(20px + 10%)
-
-
- {``}
-
-
- One
- Two
- Three
- Four
- Five
-
- >
- );
-}
-
-render( );
-```
-
-### The `rowGap` (`gridRowGap`) property
-
-```jsx noInline
-const GridItem = (props) => (
-
-);
-
-function Example() {
- const [value, setValue] = React.useState('0');
-
- return (
- <>
-
- setValue('0')}>0
- setValue('10%')}>10%
- setValue('1rem')}>1rem
- setValue('20px')}>20px
-
-
- {``}
-
-
- One
- Two
- Three
- Four
- Five
-
- >
- );
-}
-
-render( );
-```
-
-### The `columnGap` (`gridColumnGap`) property
-
-```jsx noInline
-const GridItem = (props) => (
-
-);
-
-function Example() {
- const [value, setValue] = React.useState('0');
-
- return (
- <>
-
- setValue('0')}>0
- setValue('10%')}>10%
- setValue('1rem')}>1rem
- setValue('20px')}>20px
-
-
- {``}
-
-
- One
- Two
- Three
- Four
- Five
-
- >
- );
-}
-
-render( );
-```
-
-### The `row` (`gridRow`) property
-
-```jsx noInline
-const GridItem = (props) => (
-
-);
-
-function Example() {
- const [value, setValue] = React.useState('1');
-
- return (
- <>
-
- setValue('1')}>1
- setValue('1 / 3')}>1 / 3
- setValue('2 / -1')}>2 / -1
- setValue('1 / span 2')}>1 / span 2
-
-
- One
- Two
- Three
-
- >
- );
-}
-
-render( );
-```
-
-### The `column` (`gridColumn`) property
-
-```jsx noInline
-const GridItem = (props) => (
-
-);
-
-function Example() {
- const [value, setValue] = React.useState('1');
-
- return (
- <>
-
- setValue('1')}>1
- setValue('1 / 3')}>1 / 3
- setValue('2 / -1')}>2 / -1
- setValue('1 / span 2')}>1 / span 2
-
-
- One
- Two
- Three
-
- >
- );
-}
-
-render( );
-```
-
-### The `area` (`gridArea`) property
-
-```jsx noInline
-const GridItem = (props) => (
-
-);
-
-function Example() {
- const [value, setValue] = React.useState('a');
-
- return (
- <>
-
- setValue('a')}>a
- setValue('b')}>b
- setValue('c')}>c
- setValue('2 / 1 / 2 / 4')}>2 / 1 / 2 / 4
-
-
- Example
-
- >
- );
-}
-
-render( );
-```
-
-### The `autoFlow` (`gridAutoFlow`) property
-
-```jsx noInline
-const GridItem = (props) => (
-
-);
-
-function Example() {
- const [value, setValue] = React.useState('row');
-
- return (
- <>
-
- setValue('row')}>row
- setValue('column')}>column
- setValue('row dense')}>row dense
-
-
- {``}
-
-
- One
- Two
- Three
- Four
- Five
-
- >
- );
-}
-
-render( );
-```
-
-### The `autoRows` (`gridAutoRows`) property
-
-```jsx noInline
-const GridItem = (props) => (
-
-);
-
-function Example() {
- const [value, setValue] = React.useState('auto');
-
- return (
- <>
-
- setValue('auto')}>auto
- setValue('3rem')}>3rem
- setValue('min-content')}>min-content
- setValue('minmax(2rem, auto)')}>minmax(2rem, auto)
-
-
- {``}
-
-
- One
- Two
- Three
- Four
-
-
- >
- );
-}
-
-render( );
-```
-
-### The `autoColumns` (`gridAutoColumns`) property
-
-```jsx noInline
-const GridItem = (props) => (
-
-);
-
-function Example() {
- const [value, setValue] = React.useState('auto');
-
- return (
- <>
-
- setValue('auto')}>auto
- setValue('1fr')}>1fr
- setValue('min-content')}>min-content
- setValue('minmax(3rem, auto)')}>minmax(3rem, auto)
-
-
- {``}
-
-
- One
- Two
- Three
- Four
- Five
-
- >
- );
-}
-
-render( );
-```
-
-### The `templateRows` (`gridTemplateRows`) property
-
-```jsx noInline
-const GridItem = (props) => (
-
-);
-
-function Example() {
- const [value, setValue] = React.useState('auto');
-
- return (
- <>
-
- setValue('auto')}>auto
- setValue('3rem 4rem 3rem')}>3rem 4rem 3rem
- setValue('1fr 2fr 1fr')}>1fr 2fr 1fr
- setValue('3rem auto minmax(3rem, 4rem)')}>3rem auto minmax(3rem, 4rem)
-
-
- {``}
-
-
- One
- Two
- Three
- Four
- Five
-
- >
- );
-}
-
-render( );
-```
-
-### The `templateColumns` (`gridTemplateColumns`) property
-
-```jsx noInline
-const GridItem = (props) => (
-
-);
-
-function Example() {
- const [value, setValue] = React.useState('4rem 4rem');
-
- return (
- <>
-
- setValue('4rem 4rem')}>4rem 4rem
- setValue('1fr 4rem')}>1fr 4rem
- setValue('1fr auto')}>1fr auto
- setValue('1fr 2fr')}>1fr 2fr
-
-
- {``}
-
-
- One
- Two
- Three
- Four
- Five
-
- >
- );
-}
-
-render( );
-```
-
-### The `templateAreas` (`gridTemplateAreas`) property
-
-```jsx noInline
-const GridItem = (props) => (
-
-);
-
-function Example() {
- const [value, setValue] = React.useState('"a a a" "b c c" "b c c"');
-
- return (
- <>
-
- setValue('"a a a" "b c c" "b c c"')}>
-
- "a a a"
- "b c c"
- "b c c"
-
-
- setValue('"b b a" "b b c" "b b c"')}>
-
- "b b a"
- "b b c"
- "b b c"
-
-
- setValue('"a a ." "a a ." ". b c"')}>
-
- "a a ."
- "a a ."
- ". b c"
-
-
-
-
- {``}
-
-
- One (a)
- Two (b)
- Three (c)
-
- >
- );
-}
-
-render( );
-```
-
-## Props
-
-### Grid
-
-| Name | Type | Default | Description |
-| :--- | :--- | :------ | :---------- |
-| children | ReactNode | | |
-| gap | string | | A shorthand of the `gridGap` property that sets the gaps (gutters) between rows and columns. |
-| rowGap | string | | A shorthand of the `gridRowGap` property that sets the size of the gap (gutter) between an element's grid rows. |
-| columnGap | string | | A shorthand of the `gridColumnGap` property that sets the size of the gap (gutter) between an element's columns. |
-| row | string | | A shorthand of the `gridRow` property that specifies the grid items\' location in terms of the grid\'s rows. |
-| column | string | | A shorthand of the `gridColumn` property that specifies the grid items\' location in terms of the grid\'s columns. |
-| area | string | | A shorthand of the `gridArea` property that specifies a grid item's size and location within the grid by referencing a named grid area. |
-| autoFlow | string | | A shorthand of the `gridAutoFlow` property that controls how the auto-placement algorithm works. |
-| autoRows | string | | A shorthand of the `gridAutoRows` property that specifies the size of an implicitly-created grid row track or pattern of tracks. |
-| autoColumns | string | | A shorthand of the `gridAutoColumns` property that specifies the size of an implicitly-created grid column track or pattern of tracks. |
-| templateRows | string | | A shorthand of the `gridTemplateRows` property that defines the line names and track sizing functions of the grid rows. |
-| templateColumns | string | | A shorthand of the `gridTemplateColumns` property that defines the line names and track sizing functions of the grid columns. |
-| templateAreas | string | | A shorthand of the `gridTemplateAreas` property that specifies named grid areas. |
diff --git a/packages/react-docs/pages/components/grid/grid-area.js b/packages/react-docs/pages/components/grid/grid-area.js
new file mode 100644
index 0000000000..78d1dc3de1
--- /dev/null
+++ b/packages/react-docs/pages/components/grid/grid-area.js
@@ -0,0 +1,37 @@
+import { Button, Grid, Stack } from '@tonic-ui/react';
+import React, { useState } from 'react';
+
+const GridItem = (props) => (
+
+);
+
+const App = () => {
+ const [value, setValue] = useState('a');
+
+ return (
+ <>
+
+ setValue('a')}>a
+ setValue('b')}>b
+ setValue('c')}>c
+ setValue('2 / 1 / 2 / 4')}>2 / 1 / 2 / 4
+
+
+ Example
+
+ >
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/grid/grid-auto-columns.js b/packages/react-docs/pages/components/grid/grid-auto-columns.js
new file mode 100644
index 0000000000..fb98679038
--- /dev/null
+++ b/packages/react-docs/pages/components/grid/grid-auto-columns.js
@@ -0,0 +1,38 @@
+import { Button, Grid, Stack } from '@tonic-ui/react';
+import React, { useState } from 'react';
+
+const GridItem = (props) => (
+
+);
+
+const App = () => {
+ const [value, setValue] = useState('auto');
+
+ return (
+ <>
+
+ setValue('auto')}>auto
+ setValue('1fr')}>1fr
+ setValue('min-content')}>min-content
+ setValue('minmax(3rem, auto)')}>minmax(3rem, auto)
+
+
+ {``}
+
+
+ One
+ Two
+ Three
+ Four
+ Five
+
+ >
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/grid/grid-auto-flow.js b/packages/react-docs/pages/components/grid/grid-auto-flow.js
new file mode 100644
index 0000000000..34815b42f1
--- /dev/null
+++ b/packages/react-docs/pages/components/grid/grid-auto-flow.js
@@ -0,0 +1,39 @@
+import { Button, Grid, Stack } from '@tonic-ui/react';
+import React, { useState } from 'react';
+
+const GridItem = (props) => (
+
+);
+
+const App = () => {
+ const [value, setValue] = useState('row');
+
+ return (
+ <>
+
+ setValue('row')}>row
+ setValue('column')}>column
+ setValue('row dense')}>row dense
+
+
+ {``}
+
+
+ One
+ Two
+ Three
+ Four
+ Five
+
+ >
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/grid/grid-auto-rows.js b/packages/react-docs/pages/components/grid/grid-auto-rows.js
new file mode 100644
index 0000000000..125fef6177
--- /dev/null
+++ b/packages/react-docs/pages/components/grid/grid-auto-rows.js
@@ -0,0 +1,39 @@
+import { Button, Grid, Stack } from '@tonic-ui/react';
+import React, { useState } from 'react';
+
+const GridItem = (props) => (
+
+);
+
+const App = () => {
+ const [value, setValue] = useState('auto');
+
+ return (
+ <>
+
+ setValue('auto')}>auto
+ setValue('3rem')}>3rem
+ setValue('min-content')}>min-content
+ setValue('minmax(2rem, auto)')}>minmax(2rem, auto)
+
+
+ {``}
+
+
+ One
+ Two
+ Three
+ Four
+
+
+ >
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/grid/grid-column-gap.js b/packages/react-docs/pages/components/grid/grid-column-gap.js
new file mode 100644
index 0000000000..dc4d735a84
--- /dev/null
+++ b/packages/react-docs/pages/components/grid/grid-column-gap.js
@@ -0,0 +1,39 @@
+import { Button, Grid, Stack } from '@tonic-ui/react';
+import React, { useState } from 'react';
+
+const GridItem = (props) => (
+
+);
+
+const App = () => {
+ const [value, setValue] = useState('0');
+
+ return (
+ <>
+
+ setValue('0')}>0
+ setValue('10%')}>10%
+ setValue('1rem')}>1rem
+ setValue('20px')}>20px
+
+
+ {``}
+
+
+ One
+ Two
+ Three
+ Four
+ Five
+
+ >
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/grid/grid-column.js b/packages/react-docs/pages/components/grid/grid-column.js
new file mode 100644
index 0000000000..78c546664e
--- /dev/null
+++ b/packages/react-docs/pages/components/grid/grid-column.js
@@ -0,0 +1,34 @@
+import { Button, Grid, Stack } from '@tonic-ui/react';
+import React, { useState } from 'react';
+
+const GridItem = (props) => (
+
+);
+
+const App = () => {
+ const [value, setValue] = useState('1');
+
+ return (
+ <>
+
+ setValue('1')}>1
+ setValue('1 / 3')}>1 / 3
+ setValue('2 / -1')}>2 / -1
+ setValue('1 / span 2')}>1 / span 2
+
+
+ One
+ Two
+ Three
+
+ >
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/grid/grid-gap.js b/packages/react-docs/pages/components/grid/grid-gap.js
new file mode 100644
index 0000000000..b1a4ca8952
--- /dev/null
+++ b/packages/react-docs/pages/components/grid/grid-gap.js
@@ -0,0 +1,40 @@
+import { Button, Grid, Stack } from '@tonic-ui/react';
+import React, { useState } from 'react';
+
+const GridItem = (props) => (
+
+);
+
+const App = () => {
+ const [value, setValue] = useState('0');
+
+ return (
+ <>
+
+ setValue('0')}>0
+ setValue('10%')}>10%
+ setValue('1rem')}>1rem
+ setValue('10px 20px')}>10px 20px
+ setValue('calc(20px + 10%)')}>calc(20px + 10%)
+
+
+ {``}
+
+
+ One
+ Two
+ Three
+ Four
+ Five
+
+ >
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/grid/grid-row-gap.js b/packages/react-docs/pages/components/grid/grid-row-gap.js
new file mode 100644
index 0000000000..fc221cb33e
--- /dev/null
+++ b/packages/react-docs/pages/components/grid/grid-row-gap.js
@@ -0,0 +1,39 @@
+import { Button, Grid, Stack } from '@tonic-ui/react';
+import React, { useState } from 'react';
+
+const GridItem = (props) => (
+
+);
+
+const App = () => {
+ const [value, setValue] = useState('0');
+
+ return (
+ <>
+
+ setValue('0')}>0
+ setValue('10%')}>10%
+ setValue('1rem')}>1rem
+ setValue('20px')}>20px
+
+
+ {``}
+
+
+ One
+ Two
+ Three
+ Four
+ Five
+
+ >
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/grid/grid-row.js b/packages/react-docs/pages/components/grid/grid-row.js
new file mode 100644
index 0000000000..f2728dad30
--- /dev/null
+++ b/packages/react-docs/pages/components/grid/grid-row.js
@@ -0,0 +1,34 @@
+import { Button, Grid, Stack } from '@tonic-ui/react';
+import React, { useState } from 'react';
+
+const GridItem = (props) => (
+
+);
+
+const App = () => {
+ const [value, setValue] = useState('1');
+
+ return (
+ <>
+
+ setValue('1')}>1
+ setValue('1 / 3')}>1 / 3
+ setValue('2 / -1')}>2 / -1
+ setValue('1 / span 2')}>1 / span 2
+
+
+ One
+ Two
+ Three
+
+ >
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/grid/grid-template-areas.js b/packages/react-docs/pages/components/grid/grid-template-areas.js
new file mode 100644
index 0000000000..f8fccc0253
--- /dev/null
+++ b/packages/react-docs/pages/components/grid/grid-template-areas.js
@@ -0,0 +1,56 @@
+/* eslint-disable react/no-unescaped-entities */
+import { Box, Button, Grid, Stack } from '@tonic-ui/react';
+import React, { useState } from 'react';
+
+const GridItem = (props) => (
+
+);
+
+const App = () => {
+ const [value, setValue] = useState('"a a a" "b c c" "b c c"');
+
+ return (
+ <>
+
+ setValue('"a a a" "b c c" "b c c"')}>
+
+ "a a a"
+ "b c c"
+ "b c c"
+
+
+ setValue('"b b a" "b b c" "b b c"')}>
+
+ "b b a"
+ "b b c"
+ "b b c"
+
+
+ setValue('"a a ." "a a ." ". b c"')}>
+
+ "a a ."
+ "a a ."
+ ". b c"
+
+
+
+
+ {``}
+
+
+ One (a)
+ Two (b)
+ Three (c)
+
+ >
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/grid/grid-template-columns.js b/packages/react-docs/pages/components/grid/grid-template-columns.js
new file mode 100644
index 0000000000..dab0c93174
--- /dev/null
+++ b/packages/react-docs/pages/components/grid/grid-template-columns.js
@@ -0,0 +1,38 @@
+import { Button, Grid, Stack } from '@tonic-ui/react';
+import React, { useState } from 'react';
+
+const GridItem = (props) => (
+
+);
+
+const App = () => {
+ const [value, setValue] = useState('4rem 4rem');
+
+ return (
+ <>
+
+ setValue('4rem 4rem')}>4rem 4rem
+ setValue('1fr 4rem')}>1fr 4rem
+ setValue('1fr auto')}>1fr auto
+ setValue('1fr 2fr')}>1fr 2fr
+
+
+ {``}
+
+
+ One
+ Two
+ Three
+ Four
+ Five
+
+ >
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/grid/grid-template-rows.js b/packages/react-docs/pages/components/grid/grid-template-rows.js
new file mode 100644
index 0000000000..b6dfbf39f1
--- /dev/null
+++ b/packages/react-docs/pages/components/grid/grid-template-rows.js
@@ -0,0 +1,39 @@
+import { Button, Grid, Stack } from '@tonic-ui/react';
+import React, { useState } from 'react';
+
+const GridItem = (props) => (
+
+);
+
+const App = () => {
+ const [value, setValue] = useState('auto');
+
+ return (
+ <>
+
+ setValue('auto')}>auto
+ setValue('3rem 4rem 3rem')}>3rem 4rem 3rem
+ setValue('1fr 2fr 1fr')}>1fr 2fr 1fr
+ setValue('3rem auto minmax(3rem, 4rem)')}>3rem auto minmax(3rem, 4rem)
+
+
+ {``}
+
+
+ One
+ Two
+ Three
+ Four
+ Five
+
+ >
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/grid/index.page.mdx b/packages/react-docs/pages/components/grid/index.page.mdx
new file mode 100644
index 0000000000..134cdcd75d
--- /dev/null
+++ b/packages/react-docs/pages/components/grid/index.page.mdx
@@ -0,0 +1,96 @@
+# Grid
+
+`Grid` is a [`Box`](box) with `display: grid` and comes with helpful style shorthand props.
+
+## Import
+
+```js
+import { Grid } from '@tonic-ui/react';
+```
+
+## Usage
+
+Grid provides the following style shorthand props:
+
+| Shorthand Prop | Style Prop | CSS Property | Description |
+| :------------- | :--------- | :----------- | ----------- |
+| gap | gridGap | [grid-gap](https://developer.mozilla.org/en-US/docs/Web/CSS/gap) | Sets the gaps (gutters) between rows and columns. It is a shorthand for `row-gap` and `column-gap`. |
+| rowGap | gridRowGap | [grid-row-gap](https://developer.mozilla.org/en-US/docs/Web/CSS/row-gap) | Sets the size of the gap (gutter) between an element's grid rows. |
+| columnGap | gridColumnGap | [grid-column-gap](https://developer.mozilla.org/en-US/docs/Web/CSS/column-gap) | Sets the size of the gap (gutter) between an element's columns. |
+| row | gridRow | [grid-row](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-row) | a shorthand property for `grid-row-start` and `grid-row-end`. |
+| column | gridColumn | [grid-column](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-column) | A shorthand property for `grid-column-start` and `grid-column-end`. |
+| area | gridArea | [grid-area](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-area) | A shorthand property for `grid-row-start`, `grid-column-start`, `grid-row-end` and `grid-column-end`. |
+| autoFlow | gridAutoFlow | [grid-auto-flow](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-auto-flow) | Controls how the auto-placement algorithm works. |
+| autoRows | gridAutoRows | [grid-auto-rows](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-auto-rows) | Specifies the size of an implicitly-created grid row track or pattern of tracks. |
+| autoColumns | gridAutoColumns | [grid-auto-columns](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-auto-columns) | Specifies the size of an implicitly-created grid column track or pattern of tracks. |
+| templateRows | gridTemplateRows | [grid-template-rows](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template-rows) | Defines the line names and track sizing functions of the grid rows. |
+| templateColumns | gridTemplateColumns | [grid-template-columns](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template-columns) | Defines the line names and track sizing functions of the grid columns. |
+| templateAreas | gridTemplateAreas | [grid-template-areas](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template-areas) | Specifies named grid areas. |
+
+### The `gap` (`gridGap`) property
+
+{render('./grid-gap')}
+
+### The `rowGap` (`gridRowGap`) property
+
+{render('./grid-row-gap')}
+
+### The `columnGap` (`gridColumnGap`) property
+
+{render('./grid-column-gap')}
+
+### The `row` (`gridRow`) property
+
+{render('./grid-row')}
+
+### The `column` (`gridColumn`) property
+
+{render('./grid-column')}
+
+### The `area` (`gridArea`) property
+
+{render('./grid-area')}
+
+### The `autoFlow` (`gridAutoFlow`) property
+
+{render('./grid-auto-flow')}
+
+### The `autoRows` (`gridAutoRows`) property
+
+{render('./grid-auto-rows')}
+
+### The `autoColumns` (`gridAutoColumns`) property
+
+{render('./grid-auto-columns')}
+
+### The `templateRows` (`gridTemplateRows`) property
+
+{render('./grid-template-rows')}
+
+### The `templateColumns` (`gridTemplateColumns`) property
+
+{render('./grid-template-columns')}
+
+### The `templateAreas` (`gridTemplateAreas`) property
+
+{render('./grid-template-areas')}
+
+## Props
+
+### Grid
+
+| Name | Type | Default | Description |
+| :--- | :--- | :------ | :---------- |
+| children | ReactNode | | |
+| gap | string | | A shorthand of the `gridGap` property that sets the gaps (gutters) between rows and columns. |
+| rowGap | string | | A shorthand of the `gridRowGap` property that sets the size of the gap (gutter) between an element's grid rows. |
+| columnGap | string | | A shorthand of the `gridColumnGap` property that sets the size of the gap (gutter) between an element's columns. |
+| row | string | | A shorthand of the `gridRow` property that specifies the grid items\' location in terms of the grid\'s rows. |
+| column | string | | A shorthand of the `gridColumn` property that specifies the grid items\' location in terms of the grid\'s columns. |
+| area | string | | A shorthand of the `gridArea` property that specifies a grid item's size and location within the grid by referencing a named grid area. |
+| autoFlow | string | | A shorthand of the `gridAutoFlow` property that controls how the auto-placement algorithm works. |
+| autoRows | string | | A shorthand of the `gridAutoRows` property that specifies the size of an implicitly-created grid row track or pattern of tracks. |
+| autoColumns | string | | A shorthand of the `gridAutoColumns` property that specifies the size of an implicitly-created grid column track or pattern of tracks. |
+| templateRows | string | | A shorthand of the `gridTemplateRows` property that defines the line names and track sizing functions of the grid rows. |
+| templateColumns | string | | A shorthand of the `gridTemplateColumns` property that defines the line names and track sizing functions of the grid columns. |
+| templateAreas | string | | A shorthand of the `gridTemplateAreas` property that specifies named grid areas. |
diff --git a/packages/react-docs/pages/components/image/basic.js b/packages/react-docs/pages/components/image/basic.js
new file mode 100644
index 0000000000..5752658e52
--- /dev/null
+++ b/packages/react-docs/pages/components/image/basic.js
@@ -0,0 +1,17 @@
+import { Image } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => {
+ const imageSrc = 'https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png';
+
+ return (
+
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/image/index.page.mdx b/packages/react-docs/pages/components/image/index.page.mdx
new file mode 100644
index 0000000000..1dd813cc87
--- /dev/null
+++ b/packages/react-docs/pages/components/image/index.page.mdx
@@ -0,0 +1,28 @@
+# Image
+
+`Image` is an ` ` tag replacement for displaying a static image.
+
+## Import
+
+```js
+import { Image } from '@tonic-ui/react';
+```
+
+## Usage
+
+### Basic
+
+{render('./basic')}
+
+### Inline SVG
+
+{render('./inline-svg')}
+
+## Props
+
+### Image
+
+| Name | Type | Default | Description |
+| :--- | :--- | :------ | :---------- |
+| alt | string | | Specifies an alternate text for the image, if the image for some reason cannot be displayed. |
+| src | string | | Specifies the path to the image. |
diff --git a/packages/react-docs/pages/components/image.page.mdx b/packages/react-docs/pages/components/image/inline-svg.js
similarity index 70%
rename from packages/react-docs/pages/components/image.page.mdx
rename to packages/react-docs/pages/components/image/inline-svg.js
index f71233dcba..429f501e28 100644
--- a/packages/react-docs/pages/components/image.page.mdx
+++ b/packages/react-docs/pages/components/image/inline-svg.js
@@ -1,37 +1,12 @@
-# Image
-
-`Image` is an ` ` tag replacement for displaying a static image.
-
-## Import
-
-```js
import { Image } from '@tonic-ui/react';
-```
-
-## Usage
-
-```jsx
-function Example() {
- const imageSrc = 'https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png';
-
- return (
-
- );
-}
-```
-
-### Inline SVG with data URI
+import React from 'react';
-```jsx
-function Example() {
+const App = () => {
const imageSrc = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjxzdmcgaGVpZ2h0PSIxMDI0IiB3aWR0aD0iMTAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNNTEyIDBDMjI5LjI1IDAgMCAyMjkuMjUgMCA1MTJjMCAyMjYuMjUgMTQ2LjY4OCA0MTguMTI1IDM1MC4xNTYgNDg1LjgxMiAyNS41OTQgNC42ODggMzQuOTM4LTExLjEyNSAzNC45MzgtMjQuNjI1IDAtMTIuMTg4LTAuNDY5LTUyLjU2Mi0wLjcxOS05NS4zMTJDMjQyIDkwOC44MTIgMjExLjkwNiA4MTcuNSAyMTEuOTA2IDgxNy41Yy0yMy4zMTItNTkuMTI1LTU2Ljg0NC03NC44NzUtNTYuODQ0LTc0Ljg3NS00Ni41MzEtMzEuNzUgMy41My0zMS4xMjUgMy41My0zMS4xMjUgNTEuNDA2IDMuNTYyIDc4LjQ3IDUyLjc1IDc4LjQ3IDUyLjc1IDQ1LjY4OCA3OC4yNSAxMTkuODc1IDU1LjYyNSAxNDkgNDIuNSA0LjY1NC0zMyAxNy45MDQtNTUuNjI1IDMyLjUtNjguMzc1QzMwNC45MDYgNzI1LjQzOCAxODUuMzQ0IDY4MS41IDE4NS4zNDQgNDg1LjMxMmMwLTU1LjkzOCAxOS45NjktMTAxLjU2MiA1Mi42NTYtMTM3LjQwNi01LjIxOS0xMy0yMi44NDQtNjUuMDk0IDUuMDYyLTEzNS41NjIgMCAwIDQyLjkzOC0xMy43NSAxNDAuODEyIDUyLjUgNDAuODEyLTExLjQwNiA4NC41OTQtMTcuMDMxIDEyOC4xMjUtMTcuMjE5IDQzLjUgMC4xODggODcuMzEyIDUuODc1IDEyOC4xODggMTcuMjgxIDk3LjY4OC02Ni4zMTIgMTQwLjY4OC01Mi41IDE0MC42ODgtNTIuNSAyOCA3MC41MzEgMTAuMzc1IDEyMi41NjIgNS4xMjUgMTM1LjUgMzIuODEyIDM1Ljg0NCA1Mi42MjUgODEuNDY5IDUyLjYyNSAxMzcuNDA2IDAgMTk2LjY4OC0xMTkuNzUgMjQwLTIzMy44MTIgMjUyLjY4OCAxOC40MzggMTUuODc1IDM0Ljc1IDQ3IDM0Ljc1IDk0Ljc1IDAgNjguNDM4LTAuNjg4IDEyMy42MjUtMC42ODggMTQwLjUgMCAxMy42MjUgOS4zMTIgMjkuNTYyIDM1LjI1IDI0LjU2MkM4NzcuNDM4IDkzMCAxMDI0IDczOC4xMjUgMTAyNCA1MTIgMTAyNCAyMjkuMjUgNzk0Ljc1IDAgNTEyIDB6Ii8+PC9zdmc+';
return (
);
-}
-```
-
-## Props
-
-### Image
+};
-| Name | Type | Default | Description |
-| :--- | :--- | :------ | :---------- |
-| alt | string | | Specifies an alternate text for the image, if the image for some reason cannot be displayed. |
-| src | string | | Specifies the path to the image. |
+export default App;
diff --git a/packages/react-docs/pages/components/input-base.page.mdx b/packages/react-docs/pages/components/input-base.page.mdx
deleted file mode 100644
index ec077e9200..0000000000
--- a/packages/react-docs/pages/components/input-base.page.mdx
+++ /dev/null
@@ -1,86 +0,0 @@
-# InputBase
-
-`InputBase` does not have appearance settings including default border, color, outline, and padding. It aims to be a simple building block for creating an input.
-
-## Import
-
-```js
-import { InputBase } from '@tonic-ui/react';
-```
-
-## Usage
-
-```jsx
-
-```
-
-### Attributes
-
-Standard input attributes are supported, e.g., `type`, `disabled`, `readOnly`, `required`, etc.
-
-#### `type`
-
-```jsx
-
-
- Name:
-
-
-
-
-
- Password:
-
-
-
-
-
-```
-
-#### `disabled`
-
-```jsx
-
-
-
-
-```
-
-#### `readOnly`
-
-```jsx
-
-
-
-
-```
-
-#### `required`
-
-```jsx
-
-```
-
-## Props
-
-### InputBase
-
-| Name | Type | Default | Description |
-| :--- | :--- | :------ | :---------- |
-| disabled | boolean | | If `true`, the user cannot interact with the control. |
-| readOnly | boolean | | If `true`, prevents the value of the input from being edited. |
-| error | boolean | | If `true`, the input will indicate an error. |
diff --git a/packages/react-docs/pages/components/input-base/attribute-disabled.js b/packages/react-docs/pages/components/input-base/attribute-disabled.js
new file mode 100644
index 0000000000..a6603746ba
--- /dev/null
+++ b/packages/react-docs/pages/components/input-base/attribute-disabled.js
@@ -0,0 +1,11 @@
+import { InputBase, Stack } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/input-base/attribute-readonly.js b/packages/react-docs/pages/components/input-base/attribute-readonly.js
new file mode 100644
index 0000000000..69130e3ad3
--- /dev/null
+++ b/packages/react-docs/pages/components/input-base/attribute-readonly.js
@@ -0,0 +1,11 @@
+import { InputBase, Stack } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/input-base/attribute-required.js b/packages/react-docs/pages/components/input-base/attribute-required.js
new file mode 100644
index 0000000000..79f13fb89a
--- /dev/null
+++ b/packages/react-docs/pages/components/input-base/attribute-required.js
@@ -0,0 +1,18 @@
+import { InputBase } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/input-base/attribute-type.js b/packages/react-docs/pages/components/input-base/attribute-type.js
new file mode 100644
index 0000000000..18feeca2bc
--- /dev/null
+++ b/packages/react-docs/pages/components/input-base/attribute-type.js
@@ -0,0 +1,25 @@
+import { Grid, InputBase, TextLabel } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+ Name:
+
+
+
+
+
+ Password:
+
+
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/input-base/basic.js b/packages/react-docs/pages/components/input-base/basic.js
new file mode 100644
index 0000000000..5a2991ad48
--- /dev/null
+++ b/packages/react-docs/pages/components/input-base/basic.js
@@ -0,0 +1,8 @@
+import { InputBase } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/input-base/index.page.mdx b/packages/react-docs/pages/components/input-base/index.page.mdx
new file mode 100644
index 0000000000..ebcf21f64a
--- /dev/null
+++ b/packages/react-docs/pages/components/input-base/index.page.mdx
@@ -0,0 +1,43 @@
+# InputBase
+
+`InputBase` does not have appearance settings including default border, color, outline, and padding. It aims to be a simple building block for creating an input.
+
+## Import
+
+```js
+import { InputBase } from '@tonic-ui/react';
+```
+
+## Usage
+
+{render('./basic')}
+
+### Attributes
+
+Standard input attributes are supported, e.g., `type`, `disabled`, `readOnly`, `required`, etc.
+
+#### `type`
+
+{render('./attribute-type')}
+
+#### `disabled`
+
+{render('./attribute-disabled')}
+
+#### `readOnly`
+
+{render('./attribute-readonly')}
+
+#### `required`
+
+{render('./attribute-required')}
+
+## Props
+
+### InputBase
+
+| Name | Type | Default | Description |
+| :--- | :--- | :------ | :---------- |
+| disabled | boolean | | If `true`, the user cannot interact with the control. |
+| readOnly | boolean | | If `true`, prevents the value of the input from being edited. |
+| error | boolean | | If `true`, the input will indicate an error. |
diff --git a/packages/react-docs/pages/components/input-control.page.mdx b/packages/react-docs/pages/components/input-control.page.mdx
deleted file mode 100644
index 4bfb2fc604..0000000000
--- a/packages/react-docs/pages/components/input-control.page.mdx
+++ /dev/null
@@ -1,236 +0,0 @@
-# InputControl
-
-`InputControl` is built on top of the native `Input` with the same appearance and behavior, except that it allows you to customize the input in a more convenient way. For example, input adornments can be added to the start, end, or both sides of the input.
-
-See the [Input](input) component for more information about the native input.
-
-## Import
-
-```js
-import {
- InputAdornment,
- InputControl,
-} from '@tonic-ui/react';
-```
-
-## Usage
-
-```jsx noInline
-const FormGroup = (props) => (
-
-);
-
-const useSelection = (defaultValue) => {
- const [value, setValue] = React.useState(defaultValue);
- const changeBy = (value) => () => setValue(value);
- return [value, changeBy];
-};
-
-render(() => {
- const [size, changeSizeBy] = useSelection('md');
- const [variant, changeVariantBy] = useSelection('outline');
- const [disabled, toggleDisabled] = useToggle(false);
- const [error, toggleError] = useToggle(false);
- const [readOnly, toggleReadOnly] = useToggle(false);
- const [required, toggleRequired] = useToggle(false);
-
- return (
- <>
-
-
- InputControl props
-
-
-
-
-
- size
-
-
- *:not(:first-of-type)': {
- marginLeft: -1
- }
- }}
- >
- {['sm', 'md', 'lg'].map(value => (
-
- {value}
-
- ))}
-
-
-
-
-
- variant
-
-
- *:not(:first-of-type)': {
- marginLeft: -1
- }
- }}
- >
- {['outline', 'filled', 'flush', 'unstyled'].map(value => (
-
- {value}
-
- ))}
-
-
-
-
- toggleDisabled()}
- />
-
- disabled
-
-
-
-
- toggleError()}
- />
-
- error
-
-
-
-
- toggleReadOnly()}
- />
-
- readOnly
-
-
-
-
- toggleRequired()}
- />
-
- required
-
-
-
-
- >
- );
-});
-```
-
-### Input adornments
-
-The main way to prepend or append an input adornment is to use the `InputAdornment` component. This can be used to add a prefix, a suffix, or an action to an input. For instance, you can use an icon button to hide or reveal the password.
-
-```jsx
-function Example() {
- const [colorMode] = useColorMode();
- const [colorStyle] = useColorStyle({ colorMode });
- const [view, setView] = React.useState(false);
- const toggleView = () => setView(view => !view);
- const iconColor = colorStyle.color.tertiary;
- const inputType = view ? 'text' : 'password';
-
- return (
-
-
-
-
- )}
- />
-
-
-
- )}
- />
-
- $
-
- )}
- endAdornment={(
-
-
-
- )}
- />
-
-
-
-
-
- )}
- />
-
- );
-}
-```
-
-## Props
-
-### InputAdornment
-
-| Name | Type | Default | Description |
-| :--- | :--- | :------ | :---------- |
-| children | ReactNode | | |
-
-### InputControl
-
-| Name | Type | Default | Description |
-| :--- | :--- | :------ | :---------- |
-| disabled | boolean | | If `true`, the user cannot interact with the control. |
-| error | boolean \| string | | If `true` or a non-empty string value is provided, the input will display an error state. The error message will also be set as the input's custom validity message using the `setCustomValidity()` method, allowing for form validation to be performed. |
-| endAdornment | ReactNode | | End `InputAdornment` for this component. |
-| inputComponent | ElementType | InputBase | The input component to render. |
-| inputProps | object | | Additional props to be applied to the input element. |
-| inputRef | RefObject | | A `ref` to access the input element. |
-| size | string | 'md' | The visual size of the `input` element. One of: 'sm', 'md', 'lg' |
-| variant | string | 'outline' | The variant of the input style to use. One of: 'outline', 'filled', 'flush', 'unstyled' |
-| startAdornment | ReactNode | | Start `InputAdornment` for this component. |
diff --git a/packages/react-docs/pages/components/input-control/index.page.mdx b/packages/react-docs/pages/components/input-control/index.page.mdx
new file mode 100644
index 0000000000..31858cbb9f
--- /dev/null
+++ b/packages/react-docs/pages/components/input-control/index.page.mdx
@@ -0,0 +1,46 @@
+# InputControl
+
+`InputControl` is built on top of the native `Input` with the same appearance and behavior, except that it allows you to customize the input in a more convenient way. For example, input adornments can be added to the start, end, or both sides of the input.
+
+See the [Input](input) component for more information about the native input.
+
+## Import
+
+```js
+import {
+ InputAdornment,
+ InputControl,
+} from '@tonic-ui/react';
+```
+
+## Usage
+
+{render('./usage')}
+
+### Input adornments
+
+The main way to prepend or append an input adornment is to use the `InputAdornment` component. This can be used to add a prefix, a suffix, or an action to an input. For instance, you can use an icon button to hide or reveal the password.
+
+{render('./input-adornments')}
+
+## Props
+
+### InputAdornment
+
+| Name | Type | Default | Description |
+| :--- | :--- | :------ | :---------- |
+| children | ReactNode | | |
+
+### InputControl
+
+| Name | Type | Default | Description |
+| :--- | :--- | :------ | :---------- |
+| disabled | boolean | | If `true`, the user cannot interact with the control. |
+| error | boolean \| string | | If `true` or a non-empty string value is provided, the input will display an error state. The error message will also be set as the input's custom validity message using the `setCustomValidity()` method, allowing for form validation to be performed. |
+| endAdornment | ReactNode | | End `InputAdornment` for this component. |
+| inputComponent | ElementType | InputBase | The input component to render. |
+| inputProps | object | | Additional props to be applied to the input element. |
+| inputRef | RefObject | | A `ref` to access the input element. |
+| size | string | 'md' | The visual size of the `input` element. One of: 'sm', 'md', 'lg' |
+| variant | string | 'outline' | The variant of the input style to use. One of: 'outline', 'filled', 'flush', 'unstyled' |
+| startAdornment | ReactNode | | Start `InputAdornment` for this component. |
diff --git a/packages/react-docs/pages/components/input-control/input-adornments.js b/packages/react-docs/pages/components/input-control/input-adornments.js
new file mode 100644
index 0000000000..4526905f87
--- /dev/null
+++ b/packages/react-docs/pages/components/input-control/input-adornments.js
@@ -0,0 +1,71 @@
+import {
+ ButtonBase,
+ Flex,
+ Icon,
+ InputAdornment,
+ InputControl,
+ Text,
+ useColorMode,
+ useColorStyle,
+} from '@tonic-ui/react';
+import React, { useState } from 'react';
+
+const App = () => {
+ const [colorMode] = useColorMode();
+ const [colorStyle] = useColorStyle({ colorMode });
+ const [view, setView] = useState(false);
+ const toggleView = () => setView(view => !view);
+ const iconColor = colorStyle.color.tertiary;
+
+ return (
+
+
+
+
+ )}
+ />
+
+
+
+ )}
+ />
+
+ $
+
+ )}
+ endAdornment={(
+
+
+
+ )}
+ />
+
+
+
+
+
+ )}
+ />
+
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/input-control/usage.js b/packages/react-docs/pages/components/input-control/usage.js
new file mode 100644
index 0000000000..4665122256
--- /dev/null
+++ b/packages/react-docs/pages/components/input-control/usage.js
@@ -0,0 +1,146 @@
+import {
+ Box,
+ Button,
+ ButtonGroup,
+ Checkbox,
+ Divider,
+ InputControl,
+ Space,
+ Text,
+ TextLabel,
+} from '@tonic-ui/react';
+import { useToggle } from '@tonic-ui/react-hooks';
+import React, { useState } from 'react';
+
+const FormGroup = (props) => (
+
+);
+
+const useSelection = (defaultValue) => {
+ const [value, setValue] = useState(defaultValue);
+ const changeBy = (value) => () => setValue(value);
+ return [value, changeBy];
+};
+
+const App = () => {
+ const [size, changeSizeBy] = useSelection('md');
+ const [variant, changeVariantBy] = useSelection('outline');
+ const [disabled, toggleDisabled] = useToggle(false);
+ const [error, toggleError] = useToggle(false);
+ const [readOnly, toggleReadOnly] = useToggle(false);
+ const [required, toggleRequired] = useToggle(false);
+
+ return (
+ <>
+
+
+ InputControl props
+
+
+
+
+
+ size
+
+
+ *:not(:first-of-type)': {
+ marginLeft: -1
+ }
+ }}
+ >
+ {['sm', 'md', 'lg'].map(value => (
+
+ {value}
+
+ ))}
+
+
+
+
+
+ variant
+
+
+ *:not(:first-of-type)': {
+ marginLeft: -1
+ }
+ }}
+ >
+ {['outline', 'filled', 'flush', 'unstyled'].map(value => (
+
+ {value}
+
+ ))}
+
+
+
+
+ toggleDisabled()}
+ />
+
+ disabled
+
+
+
+
+ toggleError()}
+ />
+
+ error
+
+
+
+
+ toggleReadOnly()}
+ />
+
+ readOnly
+
+
+
+
+ toggleRequired()}
+ />
+
+ required
+
+
+
+
+ >
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/input-group.page.mdx b/packages/react-docs/pages/components/input-group.page.mdx
deleted file mode 100644
index 073ba281d9..0000000000
--- a/packages/react-docs/pages/components/input-group.page.mdx
+++ /dev/null
@@ -1,291 +0,0 @@
-# InputGroup
-
-`InputGroup` is used to group related add-ons and inputs.
-
-## Import
-
-```js
-import {
- InputGroup,
- InputGroupAddon,
- InputGroupAppend,
- InputGroupPrepend,
-} from '@tonic-ui/react';
-```
-
-## Usage
-
-Use `InputGroup` to place an `InputGroupAddon` or `Button` on either side of an `Input`. You may also place one on both sides of an `Input`.
-
-```jsx
-
-
-
- @
-
-
-
-
-
-
- @example.com
-
-
-
-
- $
-
-
-
- .00
-
-
-
-```
-
-### Sizes
-
-Use the `size` prop to change the size of the input group. You can set the value to `sm`, `md`, or `lg`.
-
-```jsx
-
-
-
- sm
-
-
-
-
-
- md
-
-
-
-
-
- lg
-
-
-
-
-```
-
-### Variants
-
-The `InputGroup` component comes in 3 variants: `outline`, `filled`, `flush`, and `unstyled`. Pass the `variant` prop and set it to either of these values.
-
-#### `outline`
-
-```jsx
-
-
-
- @
-
-
-
-
-
- @
-
-
-
-
-```
-
-#### `filled`
-
-```jsx
-
-
-
- @
-
-
-
-
-
- @
-
-
-
-
-```
-
-#### `flush`
-
-```jsx
-
- @
-
-
-```
-
-#### `unstyled`
-
-```jsx
-
- @
-
-
-```
-
-### Multiple add-ons
-
-Multiple add-ons are supported and can be mixed with checkbox and radio input components.
-
-```jsx
-
-
-
- $
-
-
- 0.00
-
-
-
-
-
-
- $
-
-
- 0.00
-
-
-
-```
-
-### Multiple inputs
-
-While multiple ` `s are supported visually, validation styles are only available for input groups with a single ` `.
-
-```jsx
-
-
- First and last name
-
-
-
-
-```
-
-### Date inputs
-
-```jsx
-
-
- –
-
- –
-
-
-```
-
-### Button add-ons
-
-```jsx noInline
-function Example() {
- const [colorMode] = useColorMode();
- const dividerColor ={
- dark: 'gray:70',
- light: 'gray:30',
- }[colorMode];
-
- return (
-
-
-
-
- Action
-
-
-
-
-
-
-
-
- Action
-
-
-
-
-
-
- Host name
-
-
-
-
-
-
-
- Action
-
-
-
-
-
-
-
- Action
-
-
-
-
-
-
-
-
- );
-}
-
-render( );
-```
-
-## Props
-
-### InputGroup
-
-| Name | Type | Default | Description |
-| :--- | :--- | :------ | :---------- |
-| children | ReactNode \| `(context) => ReactNode` | | A function child can be used intead of a React element. This function is called with the context object. |
-| size | string | 'md' | The relative size to the input group itself. One of: 'sm', 'md', 'lg' |
-| variant | string | 'outline' | The variant of the input style to use. One of: 'outline', 'filled', 'flush', 'unstyled' |
-
-### InputGroupAddon
-
-| Name | Type | Default | Description |
-| :--- | :--- | :------ | :---------- |
-| children | ReactNode | | |
-| size | string | 'md' | The relative size to the input group itself. One of: 'sm', 'md', 'lg' |
-| variant | string | 'outline' | The variant of the input style to use. One of: 'outline', 'filled', 'flush', 'unstyled' |
-
-### InputGroupAppend
-
-| Name | Type | Default | Description |
-| :--- | :--- | :------ | :---------- |
-| children | ReactNode | | |
-
-### InputGroupPrepend
-
-| Name | Type | Default | Description |
-| :--- | :--- | :------ | :---------- |
-| children | ReactNode | | |
diff --git a/packages/react-docs/pages/components/input-group/basic.js b/packages/react-docs/pages/components/input-group/basic.js
new file mode 100644
index 0000000000..832cfca531
--- /dev/null
+++ b/packages/react-docs/pages/components/input-group/basic.js
@@ -0,0 +1,30 @@
+import { Input, InputGroup, InputGroupAddon, InputGroupAppend, InputGroupPrepend, Stack } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+
+ @
+
+
+
+
+
+
+ @example.com
+
+
+
+
+ $
+
+
+
+ .00
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/input-group/button-add-ons.js b/packages/react-docs/pages/components/input-group/button-add-ons.js
new file mode 100644
index 0000000000..39cbd780c3
--- /dev/null
+++ b/packages/react-docs/pages/components/input-group/button-add-ons.js
@@ -0,0 +1,72 @@
+import {
+ Button,
+ ButtonGroup,
+ Divider,
+ Icon,
+ Input,
+ InputGroup,
+ InputGroupAppend,
+ InputGroupPrepend,
+ Space,
+ Stack,
+ useColorMode,
+} from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => {
+ const [colorMode] = useColorMode();
+ const dividerColor ={
+ dark: 'gray:70',
+ light: 'gray:30',
+ }[colorMode];
+
+ return (
+
+
+
+
+ Action
+
+
+
+
+
+
+
+
+ Action
+
+
+
+
+
+
+ Host name
+
+
+
+
+
+
+
+ Action
+
+
+
+
+
+
+
+ Action
+
+
+
+
+
+
+
+
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/input-group/date-inputs.js b/packages/react-docs/pages/components/input-group/date-inputs.js
new file mode 100644
index 0000000000..6c043685ae
--- /dev/null
+++ b/packages/react-docs/pages/components/input-group/date-inputs.js
@@ -0,0 +1,29 @@
+import { Input, InputGroup, Text } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+ –
+
+ –
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/input-group/index.page.mdx b/packages/react-docs/pages/components/input-group/index.page.mdx
new file mode 100644
index 0000000000..251d825dbe
--- /dev/null
+++ b/packages/react-docs/pages/components/input-group/index.page.mdx
@@ -0,0 +1,96 @@
+# InputGroup
+
+`InputGroup` is used to group related add-ons and inputs.
+
+## Import
+
+```js
+import {
+ InputGroup,
+ InputGroupAddon,
+ InputGroupAppend,
+ InputGroupPrepend,
+} from '@tonic-ui/react';
+```
+
+## Usage
+
+Use `InputGroup` to place an `InputGroupAddon` or `Button` on either side of an `Input`. You may also place one on both sides of an `Input`.
+
+{render('./basic')}
+
+### Sizes
+
+Use the `size` prop to change the size of the input group. You can set the value to `sm`, `md`, or `lg`.
+
+{render('./sizes')}
+
+### Variants
+
+The `InputGroup` component comes in 3 variants: `outline`, `filled`, `flush`, and `unstyled`. Pass the `variant` prop and set it to either of these values.
+
+#### `outline`
+
+{render('./variant-outline')}
+
+#### `filled`
+
+{render('./variant-filled')}
+
+#### `flush`
+
+{render('./variant-flush')}
+
+#### `unstyled`
+
+{render('./variant-unstyled')}
+
+### Multiple add-ons
+
+Multiple add-ons are supported and can be mixed with checkbox and radio input components.
+
+{render('./multiple-add-ons')}
+
+### Multiple inputs
+
+While multiple ` `s are supported visually, validation styles are only available for input groups with a single ` `.
+
+{render('./multiple-inputs')}
+
+### Date inputs
+
+{render('./date-inputs')}
+
+### Button add-ons
+
+{render('./button-add-ons')}
+
+## Props
+
+### InputGroup
+
+| Name | Type | Default | Description |
+| :--- | :--- | :------ | :---------- |
+| children | ReactNode \| `(context) => ReactNode` | | A function child can be used intead of a React element. This function is called with the context object. |
+| size | string | 'md' | The relative size to the input group itself. One of: 'sm', 'md', 'lg' |
+| variant | string | 'outline' | The variant of the input style to use. One of: 'outline', 'filled', 'flush', 'unstyled' |
+
+### InputGroupAddon
+
+| Name | Type | Default | Description |
+| :--- | :--- | :------ | :---------- |
+| children | ReactNode | | |
+| size | string | 'md' | The relative size to the input group itself. One of: 'sm', 'md', 'lg' |
+| variant | string | 'outline' | The variant of the input style to use. One of: 'outline', 'filled', 'flush', 'unstyled' |
+
+### InputGroupAppend
+
+| Name | Type | Default | Description |
+| :--- | :--- | :------ | :---------- |
+| children | ReactNode | | |
+
+### InputGroupPrepend
+
+| Name | Type | Default | Description |
+| :--- | :--- | :------ | :---------- |
+| children | ReactNode | | |
diff --git a/packages/react-docs/pages/components/input-group/multiple-add-ons.js b/packages/react-docs/pages/components/input-group/multiple-add-ons.js
new file mode 100644
index 0000000000..0ebccde6d5
--- /dev/null
+++ b/packages/react-docs/pages/components/input-group/multiple-add-ons.js
@@ -0,0 +1,27 @@
+import { Input, InputGroup, InputGroupAddon, InputGroupAppend, InputGroupPrepend, Stack } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+
+ $
+
+
+ 0.00
+
+
+
+
+
+
+ $
+
+
+ 0.00
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/input-group/multiple-inputs.js b/packages/react-docs/pages/components/input-group/multiple-inputs.js
new file mode 100644
index 0000000000..fa313a11f7
--- /dev/null
+++ b/packages/react-docs/pages/components/input-group/multiple-inputs.js
@@ -0,0 +1,14 @@
+import { Input, InputGroup, InputGroupAddon, InputGroupPrepend } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+ First and last name
+
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/input-group/sizes.js b/packages/react-docs/pages/components/input-group/sizes.js
new file mode 100644
index 0000000000..2a400f620d
--- /dev/null
+++ b/packages/react-docs/pages/components/input-group/sizes.js
@@ -0,0 +1,33 @@
+import {
+ Input,
+ InputGroup,
+ InputGroupAddon,
+ InputGroupPrepend,
+ Stack,
+} from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+
+ sm
+
+
+
+
+
+ md
+
+
+
+
+
+ lg
+
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/input-group/variant-filled.js b/packages/react-docs/pages/components/input-group/variant-filled.js
new file mode 100644
index 0000000000..0e20f54f4c
--- /dev/null
+++ b/packages/react-docs/pages/components/input-group/variant-filled.js
@@ -0,0 +1,21 @@
+import { Input, InputGroup, InputGroupAddon, InputGroupPrepend, Stack } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+
+ @
+
+
+
+
+
+ @
+
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/input-group/variant-flush.js b/packages/react-docs/pages/components/input-group/variant-flush.js
new file mode 100644
index 0000000000..1ce2ce34fa
--- /dev/null
+++ b/packages/react-docs/pages/components/input-group/variant-flush.js
@@ -0,0 +1,11 @@
+import { Input, InputGroup, InputGroupAddon } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+ @
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/input-group/variant-outline.js b/packages/react-docs/pages/components/input-group/variant-outline.js
new file mode 100644
index 0000000000..b80f023dbb
--- /dev/null
+++ b/packages/react-docs/pages/components/input-group/variant-outline.js
@@ -0,0 +1,21 @@
+import { Input, InputGroup, InputGroupAddon, InputGroupPrepend, Stack } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+
+ @
+
+
+
+
+
+ @
+
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/input-group/variant-unstyled.js b/packages/react-docs/pages/components/input-group/variant-unstyled.js
new file mode 100644
index 0000000000..d2d4706dff
--- /dev/null
+++ b/packages/react-docs/pages/components/input-group/variant-unstyled.js
@@ -0,0 +1,11 @@
+import { Input, InputGroup, InputGroupAddon } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+ @
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/input.page.mdx b/packages/react-docs/pages/components/input.page.mdx
deleted file mode 100644
index 517d92196e..0000000000
--- a/packages/react-docs/pages/components/input.page.mdx
+++ /dev/null
@@ -1,224 +0,0 @@
-# Input
-
-The `Input` component is used to get user input in a text field.
-
-Check out the [InputControl](input-control) component if you want to do more advanced stuff with the input.
-
-## Import
-
-```js
-import { Input } from '@tonic-ui/react';
-```
-
-## Usage
-
-```jsx
-<>
- Label:
-
- Help text for the text input
->
-```
-
-### Sizes
-
-Use the `size` prop to change the size of the `Input`. You can set the value to `sm`, `md`, or `lg`.
-
-```jsx
-
-
- Label:
-
-
-
- Label:
-
-
-
- Label:
-
-
-
-```
-
-### Variants
-
-The `Input` component comes in 3 variants: `outline`, `filled`, `flush`, and `unstyled`. Pass the `variant` prop and set it to either of these values.
-
-#### `outline`
-
-```jsx
-
-```
-
-#### `filled`
-
-```jsx
-
-```
-
-#### `flush`
-
-```jsx
-
-```
-
-#### `unstyled`
-
-```jsx
-
-```
-
-### Attributes
-
-Standard input attributes are supported, e.g., `type`, `disabled`, `readOnly`, `required`, `list`, etc.
-
-#### `type`
-
-```jsx
-
-
- Name:
-
-
-
-
-
- Password:
-
-
-
-
-
-```
-
-#### `disabled`
-
-```jsx
-
-
-
-
-```
-
-#### `readOnly`
-
-```jsx
-
-
-
-
-```
-
-#### `required`
-
-```jsx
-
-```
-
-#### `list`
-
-The value of `list` is the id attribute of the `` of autocomplete options. The HTML `` element contains a set of `` elements that represent the permissible or recommended options available to choose from within other controls.
-
-```jsx
-<>
-
-
- Choose a browser from the list:
-
-
-
-
-
-
-
-
-
-
-
->
-```
-
-### Validation
-
-The `Input` component provides a built-in validation mechanism that can be used to indicate when a field is not valid. When the `error` prop is set to true, a red border is displayed around the input field, allowing you to provide user-friendly form validation feedback.
-
-In addition to the built-in validation mechanism, you can use the native `setCustomValidity()` method to set a custom validation message for the input. This method is available on the input element and allows you to set a custom error message that will be displayed when the field is invalid.
-
-```jsx noInline
-const InlineError = (props) => (
-
-);
-
-const TextField = React.forwardRef((
- {
- value,
- onChange,
- ...rest
- },
- ref,
-) => {
- const nodeRef = React.useRef();
- const combinedRef = useMergeRefs(nodeRef, ref);
- const error = (value === '') ? 'Please fill out this field' : null;
-
- // Optional
- React.useEffect(() => {
- const el = nodeRef.current;
- const errorMessage = !!error ? error : '';
- el.setCustomValidity(errorMessage);
- }, [error]);
-
- return (
- <>
-
-
- {error && (
-
-
-
- )}
-
-
- {error && (
- {error}
- )}
-
- >
- );
-});
-
-render(() => {
- const [value, setValue] = React.useState('');
- const onChange = (e) => {
- setValue(e.target.value);
- };
-
- return (
-
- );
-});
-```
-
-## Props
-
-### Input
-
-| Name | Type | Default | Description |
-| :--- | :--- | :------ | :---------- |
-| disabled | boolean | | If `true`, the input is disabled and the user cannot interact with it. |
-| error | boolean | | If `true`, the input displays a red border to indicate an error. |
-| readOnly | boolean | | If `true`, the value of the input cannot be edited. |
-| size | string | 'md' | The visual size of the `input` element. One of: 'sm', 'md', 'lg' |
-| variant | string | 'outline' | The variant of the input style to use. One of: 'outline', 'filled', 'flush', 'unstyled' |
diff --git a/packages/react-docs/pages/components/input/attribute-disabled.js b/packages/react-docs/pages/components/input/attribute-disabled.js
new file mode 100644
index 0000000000..09d723f8be
--- /dev/null
+++ b/packages/react-docs/pages/components/input/attribute-disabled.js
@@ -0,0 +1,11 @@
+import { Input, Stack } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/input/attribute-list.js b/packages/react-docs/pages/components/input/attribute-list.js
new file mode 100644
index 0000000000..95d27e7dad
--- /dev/null
+++ b/packages/react-docs/pages/components/input/attribute-list.js
@@ -0,0 +1,23 @@
+import { Box, Flex, Input, TextLabel } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+ <>
+
+
+ Choose a browser from the list:
+
+
+
+
+
+
+
+
+
+
+
+ >
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/input/attribute-readonly.js b/packages/react-docs/pages/components/input/attribute-readonly.js
new file mode 100644
index 0000000000..a13d5e4b7b
--- /dev/null
+++ b/packages/react-docs/pages/components/input/attribute-readonly.js
@@ -0,0 +1,11 @@
+import { Input, Stack } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/input/attribute-required.js b/packages/react-docs/pages/components/input/attribute-required.js
new file mode 100644
index 0000000000..447df2ef15
--- /dev/null
+++ b/packages/react-docs/pages/components/input/attribute-required.js
@@ -0,0 +1,8 @@
+import { Input } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/input/attribute-type.js b/packages/react-docs/pages/components/input/attribute-type.js
new file mode 100644
index 0000000000..0abaecb305
--- /dev/null
+++ b/packages/react-docs/pages/components/input/attribute-type.js
@@ -0,0 +1,25 @@
+import { Grid, Input, TextLabel } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+ Name:
+
+
+
+
+
+ Password:
+
+
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/input/basic.js b/packages/react-docs/pages/components/input/basic.js
new file mode 100644
index 0000000000..afeef3bfe3
--- /dev/null
+++ b/packages/react-docs/pages/components/input/basic.js
@@ -0,0 +1,12 @@
+import { Input, Text, TextLabel } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+ <>
+ Label:
+
+ Help text for the text input
+ >
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/input/index.page.mdx b/packages/react-docs/pages/components/input/index.page.mdx
new file mode 100644
index 0000000000..60602f97ef
--- /dev/null
+++ b/packages/react-docs/pages/components/input/index.page.mdx
@@ -0,0 +1,87 @@
+# Input
+
+The `Input` component is used to get user input in a text field.
+
+Check out the [InputControl](input-control) component if you want to do more advanced stuff with the input.
+
+## Import
+
+```js
+import { Input } from '@tonic-ui/react';
+```
+
+## Usage
+
+{render('./basic')}
+
+### Sizes
+
+Use the `size` prop to change the size of the `Input`. You can set the value to `sm`, `md`, or `lg`.
+
+{render('./sizes')}
+
+### Variants
+
+The `Input` component comes in 3 variants: `outline`, `filled`, `flush`, and `unstyled`. Pass the `variant` prop and set it to either of these values.
+
+#### `outline`
+
+{render('./variant-outline')}
+
+#### `filled`
+
+{render('./variant-filled')}
+
+#### `flush`
+
+{render('./variant-flush')}
+
+#### `unstyled`
+
+{render('./variant-unstyled')}
+
+### Attributes
+
+Standard input attributes are supported, e.g., `type`, `disabled`, `readOnly`, `required`, `list`, etc.
+
+#### `type`
+
+{render('./attribute-type')}
+
+#### `disabled`
+
+{render('./attribute-disabled')}
+
+#### `readOnly`
+
+{render('./attribute-readonly')}
+
+#### `required`
+
+{render('./attribute-required')}
+
+#### `list`
+
+The value of `list` is the id attribute of the `` of autocomplete options. The HTML `` element contains a set of `` elements that represent the permissible or recommended options available to choose from within other controls.
+
+{render('./attribute-list')}
+
+### Validation
+
+The `Input` component provides a built-in validation mechanism that can be used to indicate when a field is not valid. When the `error` prop is set to true, a red border is displayed around the input field, allowing you to provide user-friendly form validation feedback.
+
+In addition to the built-in validation mechanism, you can use the native `setCustomValidity()` method to set a custom validation message for the input. This method is available on the input element and allows you to set a custom error message that will be displayed when the field is invalid.
+
+{render('./validation')}
+
+## Props
+
+### Input
+
+| Name | Type | Default | Description |
+| :--- | :--- | :------ | :---------- |
+| disabled | boolean | | If `true`, the input is disabled and the user cannot interact with it. |
+| error | boolean | | If `true`, the input displays a red border to indicate an error. |
+| readOnly | boolean | | If `true`, the value of the input cannot be edited. |
+| size | string | 'md' | The visual size of the `input` element. One of: 'sm', 'md', 'lg' |
+| variant | string | 'outline' | The variant of the input style to use. One of: 'outline', 'filled', 'flush', 'unstyled' |
diff --git a/packages/react-docs/pages/components/input/sizes.js b/packages/react-docs/pages/components/input/sizes.js
new file mode 100644
index 0000000000..a890ca287e
--- /dev/null
+++ b/packages/react-docs/pages/components/input/sizes.js
@@ -0,0 +1,21 @@
+import { Box, Input, Stack, TextLabel } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+ Label:
+
+
+
+ Label:
+
+
+
+ Label:
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/input/validation.js b/packages/react-docs/pages/components/input/validation.js
new file mode 100644
index 0000000000..e744266150
--- /dev/null
+++ b/packages/react-docs/pages/components/input/validation.js
@@ -0,0 +1,66 @@
+import { Box, Flex, Icon, Input, Text } from '@tonic-ui/react';
+import { useMergeRefs } from '@tonic-ui/react-hooks';
+import React, { forwardRef, useEffect, useRef } from 'react';
+
+const InlineError = (props) => (
+
+);
+
+const TextField = forwardRef((
+ {
+ value,
+ onChange,
+ ...rest
+ },
+ ref,
+) => {
+ const nodeRef = useRef();
+ const combinedRef = useMergeRefs(nodeRef, ref);
+ const error = (value === '') ? 'Please fill out this field' : null;
+
+ // Optional
+ useEffect(() => {
+ const el = nodeRef.current;
+ const errorMessage = error || '';
+ el.setCustomValidity(errorMessage);
+ }, [error]);
+
+ return (
+ <>
+
+
+ {error && (
+
+
+
+ )}
+
+
+ {error && (
+ {error}
+ )}
+
+ >
+ );
+});
+TextField.displayName = 'TextField';
+
+const App = () => {
+ const [value, setValue] = React.useState('');
+ const onChange = (e) => {
+ setValue(e.target.value);
+ };
+
+ return (
+
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/input/variant-filled.js b/packages/react-docs/pages/components/input/variant-filled.js
new file mode 100644
index 0000000000..879ccf6c1e
--- /dev/null
+++ b/packages/react-docs/pages/components/input/variant-filled.js
@@ -0,0 +1,8 @@
+import { Input } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/input/variant-flush.js b/packages/react-docs/pages/components/input/variant-flush.js
new file mode 100644
index 0000000000..5fc2ba9993
--- /dev/null
+++ b/packages/react-docs/pages/components/input/variant-flush.js
@@ -0,0 +1,8 @@
+import { Input } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/input/variant-outline.js b/packages/react-docs/pages/components/input/variant-outline.js
new file mode 100644
index 0000000000..d6f1bc5253
--- /dev/null
+++ b/packages/react-docs/pages/components/input/variant-outline.js
@@ -0,0 +1,8 @@
+import { Input } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/input/variant-unstyled.js b/packages/react-docs/pages/components/input/variant-unstyled.js
new file mode 100644
index 0000000000..7c832204f0
--- /dev/null
+++ b/packages/react-docs/pages/components/input/variant-unstyled.js
@@ -0,0 +1,8 @@
+import { Input } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/link-button/basic.js b/packages/react-docs/pages/components/link-button/basic.js
new file mode 100644
index 0000000000..b113b7d693
--- /dev/null
+++ b/packages/react-docs/pages/components/link-button/basic.js
@@ -0,0 +1,28 @@
+import { LinkButton, Text } from '@tonic-ui/react';
+import React, { useEffect, useState } from 'react';
+
+const App = () => {
+ const [timeLeft, setTimeLeft] = useState(180);
+ useEffect(() => {
+ const timer = setTimeout(() => {
+ if (timeLeft > 0) {
+ setTimeLeft(timeLeft - 1);
+ }
+ }, 1000);
+
+ return () => {
+ clearTimeout(timer);
+ };
+ }, [timeLeft]);
+ const handleClick = () => {
+ setTimeLeft(180);
+ };
+
+ return (
+
+ If the email does not arrive in your inbox or spam folder, click here to resend ({timeLeft}s) .
+
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/link-button.page.mdx b/packages/react-docs/pages/components/link-button/index.page.mdx
similarity index 53%
rename from packages/react-docs/pages/components/link-button.page.mdx
rename to packages/react-docs/pages/components/link-button/index.page.mdx
index cbdc14fdd4..2e491de11e 100644
--- a/packages/react-docs/pages/components/link-button.page.mdx
+++ b/packages/react-docs/pages/components/link-button/index.page.mdx
@@ -10,31 +10,7 @@ import { LinkButton } from '@tonic-ui/react';
## Usage
-```jsx
-function Example() {
- const [timeLeft, setTimeLeft] = React.useState(180);
- React.useEffect(() => {
- const timer = setTimeout(() => {
- if (timeLeft > 0) {
- setTimeLeft(timeLeft - 1);
- }
- }, 1000);
-
- return () => {
- clearTimeout(timer);
- };
- }, [timeLeft]);
- const handleClick = () => {
- setTimeLeft(180);
- };
-
- return (
-
- If the email does not arrive in your inbox or spam folder, click here to resend ({timeLeft}s) .
-
- );
-}
-```
+{render('./basic')}
## Props
diff --git a/packages/react-docs/pages/components/link.page.mdx b/packages/react-docs/pages/components/link.page.mdx
deleted file mode 100644
index a676299bf6..0000000000
--- a/packages/react-docs/pages/components/link.page.mdx
+++ /dev/null
@@ -1,118 +0,0 @@
-# Link
-
-Links are accessible elements used primarily for navigation. This component is styled to resemble a hyperlink and semantically renders an ``.
-
-## Import
-
-```js
-import { Link } from '@tonic-ui/react';
-```
-
-## Usage
-
-### Default
-
-```jsx
-
- Trend Micro Frontend
-
-```
-
-
-### Underlined link
-
-```jsx
-
- Trend Micro Frontend
-
-```
-
-### Link with icon
-
-```jsx
-
-
-
-
- Trend Micro Frontend
-
-
-
-
- Trend Micro Frontend
-
-
-```
-
-### Link with `disabled` attribute
-
-```jsx
-
-
- Trend Micro Frontend
-
-
- Trend Micro Frontend
-
-
-```
-
-### Link to another page
-
-```jsx
-
- Trend Micro Frontend
-
-```
-
-You can also create an `ExternalLink` component for enhanced usability.
-
-```jsx noInline
-const ExternalLink = React.forwardRef((props, ref) => (
-
-));
-
-render(
-
- Open link in new window
-
-
-
-);
-```
-
-## Props
-
-### Link
-
-| Name | Type | Default | Description |
-| :--- | :--- | :------ | :---------- |
-| children | ReactNode | | |
-| disabled | boolean | | If `true`, the link will be disabled. This sets `aria-disabled=true` and you can style this state by using the `_disabled` prop. |
-| onClick | function | | A callback called when the link is clicked. |
diff --git a/packages/react-docs/pages/components/link/default.js b/packages/react-docs/pages/components/link/default.js
new file mode 100644
index 0000000000..01cc4d3630
--- /dev/null
+++ b/packages/react-docs/pages/components/link/default.js
@@ -0,0 +1,12 @@
+import { Link } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+ Trend Micro Frontend
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/link/index.page.mdx b/packages/react-docs/pages/components/link/index.page.mdx
new file mode 100644
index 0000000000..4044649f06
--- /dev/null
+++ b/packages/react-docs/pages/components/link/index.page.mdx
@@ -0,0 +1,42 @@
+# Link
+
+Links are accessible elements used primarily for navigation. This component is styled to resemble a hyperlink and semantically renders an ` `.
+
+## Import
+
+```js
+import { Link } from '@tonic-ui/react';
+```
+
+## Usage
+
+### Default
+
+{render('./default')}
+
+
+### Underlined link
+
+{render('./underlined-link')}
+
+### Link with icon
+
+{render('./link-with-icon')}
+
+### Link with `disabled` attribute
+
+{render('./link-with-disabled-attribute')}
+
+### Link to another page
+
+{render('./link-to-another-page')}
+
+## Props
+
+### Link
+
+| Name | Type | Default | Description |
+| :--- | :--- | :------ | :---------- |
+| children | ReactNode | | |
+| disabled | boolean | | If `true`, the link will be disabled. This sets `aria-disabled=true` and you can style this state by using the `_disabled` prop. |
+| onClick | function | | A callback called when the link is clicked. |
diff --git a/packages/react-docs/pages/components/link/link-to-another-page.js b/packages/react-docs/pages/components/link/link-to-another-page.js
new file mode 100644
index 0000000000..42653a127d
--- /dev/null
+++ b/packages/react-docs/pages/components/link/link-to-another-page.js
@@ -0,0 +1,22 @@
+import { Icon, Link, Space } from '@tonic-ui/react';
+import React, { forwardRef } from 'react';
+
+const ExternalLink = forwardRef((props, ref) => (
+
+));
+ExternalLink.displayName = 'ExternalLink';
+
+const App = () => (
+
+ Open link in new window
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/link/link-with-disabled-attribute.js b/packages/react-docs/pages/components/link/link-with-disabled-attribute.js
new file mode 100644
index 0000000000..d979fa851e
--- /dev/null
+++ b/packages/react-docs/pages/components/link/link-with-disabled-attribute.js
@@ -0,0 +1,22 @@
+import { Link, Stack } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+ Trend Micro Frontend
+
+
+ Trend Micro Frontend
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/link/link-with-icon.js b/packages/react-docs/pages/components/link/link-with-icon.js
new file mode 100644
index 0000000000..d12873aa73
--- /dev/null
+++ b/packages/react-docs/pages/components/link/link-with-icon.js
@@ -0,0 +1,24 @@
+import { Icon, Link, Space, Stack } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+
+
+ Trend Micro Frontend
+
+
+
+
+ Trend Micro Frontend
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/link/underlined-link.js b/packages/react-docs/pages/components/link/underlined-link.js
new file mode 100644
index 0000000000..d81ad42acd
--- /dev/null
+++ b/packages/react-docs/pages/components/link/underlined-link.js
@@ -0,0 +1,13 @@
+import { Link } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+ Trend Micro Frontend
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/menu/basic.js b/packages/react-docs/pages/components/menu/basic.js
new file mode 100644
index 0000000000..50ac2d7ae5
--- /dev/null
+++ b/packages/react-docs/pages/components/menu/basic.js
@@ -0,0 +1,29 @@
+import { Flex, Icon, MenuDivider, MenuItem, Text } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+
+ Settings
+
+
+
+ Accounts
+
+
+
+ Privacy control
+
+
+
+
+ Restore Defaults
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/menu/cascading-submenus.js b/packages/react-docs/pages/components/menu/cascading-submenus.js
new file mode 100644
index 0000000000..0c625bf587
--- /dev/null
+++ b/packages/react-docs/pages/components/menu/cascading-submenus.js
@@ -0,0 +1,127 @@
+import { Flex, Icon, MenuDivider, MenuItem, Submenu, SubmenuList, SubmenuToggle, Text } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+
+ List item
+
+
+ List item
+
+
+
+
+
+
+ Submenu
+
+
+
+
+
+
+ List item
+
+
+ List item
+
+
+
+
+
+ Submenu
+
+
+
+
+
+
+ List item
+
+
+ List item
+
+
+
+
+
+
+
+
+ List item
+
+
+ List item
+
+
+
+
+
+
+
+ Submenu
+
+
+
+
+
+ List item
+
+
+ List item
+
+
+
+
+
+
+ Submenu
+
+
+
+
+
+ List item
+
+
+ List item
+
+
+
+
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/menu/controlled.js b/packages/react-docs/pages/components/menu/controlled.js
new file mode 100644
index 0000000000..03a5c7a22b
--- /dev/null
+++ b/packages/react-docs/pages/components/menu/controlled.js
@@ -0,0 +1,64 @@
+import { Flex, Icon, Menu, MenuButton, MenuDivider, MenuItem, MenuList, Submenu, SubmenuList, SubmenuToggle, Text } from '@tonic-ui/react';
+import { useToggle } from '@tonic-ui/react-hooks';
+import { isNullish } from '@tonic-ui/utils';
+import React, { useState } from 'react';
+
+const App = () => {
+ const [isOpen, toggleIsOpen] = useToggle(false);
+ const onClose = () => toggleIsOpen(false);
+ const [selectedValue, setSelectedValue] = useState(null);
+ const handleClickMenuItem = (event) => {
+ const value = event.target.getAttribute('value');
+ if (!isNullish(value)) {
+ setSelectedValue(value);
+ }
+ };
+
+ return (
+
+
+
+ Options
+
+
+
+ List item 1
+
+
+ List item 2
+
+
+
+
+
+
+ Submenu
+
+
+
+
+
+
+ List item 3
+
+
+ List item 4
+
+
+
+
+
+ Selected: {selectedValue}
+
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/menu/index.page.mdx b/packages/react-docs/pages/components/menu/index.page.mdx
index bfabc7aab8..273ca6edda 100644
--- a/packages/react-docs/pages/components/menu/index.page.mdx
+++ b/packages/react-docs/pages/components/menu/index.page.mdx
@@ -44,472 +44,43 @@ import {
Below is a simple example that shows the basic menu structure.
-```jsx
-
-
-
- Settings
-
-
-
- Accounts
-
-
-
- Privacy control
-
-
-
-
- Restore Defaults
-
-
-```
+{render('./basic')}
### Cascading submenus
The following example shows a menu with cascading submenus.
-```jsx
-
-
-
- List item
-
-
- List item
-
-
-
-
-
-
- Submenu
-
-
-
-
-
-
- List item
-
-
- List item
-
-
-
-
-
- Submenu
-
-
-
-
-
-
- List item
-
-
- List item
-
-
-
-
-
-
-
-
- List item
-
-
- List item
-
-
-
-
-
-
-
- Submenu
-
-
-
-
-
- List item
-
-
- List item
-
-
-
-
-
-
- Submenu
-
-
-
-
-
- List item
-
-
- List item
-
-
-
-
-
-
-
-```
+{render('./cascading-submenus')}
### Controlled and uncontrolled menu
Pass `isOpen` to the `Menu` component to control the state of the menu.
-```jsx
-function Example() {
- const [isOpen, toggleIsOpen] = useToggle(false);
- const onClose = () => toggleIsOpen(false);
- const [selectedValue, setSelectedValue] = React.useState(null);
- const handleClickMenuItem = (event) => {
- const value = event.target.getAttribute('value');
- if (!isNullOrUndefined(value)) {
- setSelectedValue(value);
- }
- };
-
- return (
-
-
-
- Options
-
-
-
- List item 1
-
-
- List item 2
-
-
-
-
-
-
- Submenu
-
-
-
-
-
-
- List item 3
-
-
- List item 4
-
-
-
-
-
- Selected: {selectedValue}
-
- );
-}
-```
+{render('./controlled')}
Menu is uncontrolled by default. You can set `defaultIsOpen` to `true` to have the menu open for the first render.
-```jsx
-function Example() {
- const [selectedValue, setSelectedValue] = React.useState(null);
- const handleClickMenuItem = (event) => {
- const value = event.target.getAttribute('value');
- if (!isNullOrUndefined(value)) {
- setSelectedValue(value);
- }
- };
-
- return (
-
-
-
- Options
-
-
-
- List item 1
-
-
- List item 2
-
-
-
-
-
-
- Submenu
-
-
-
-
-
-
- List item 3
-
-
- List item 4
-
-
-
-
-
- Selected: {selectedValue}
-
- );
-}
-```
+{render('./uncontrolled')}
### MenuToggle
`MenuToggle` is a toggle that opens the menu when clicked. It is usually a button or link. The `MenuToggleIcon` can be added to the toggle to indicate the menu is open or closed.
-```jsx
-
-
-
- Options
-
-
-
- List item 1
-
-
- List item 2
-
-
- List item 3
-
-
-
-
-
-
-
- Options
-
-
-
-
-
-
- List item 1
-
-
- List item 2
-
-
- List item 3
-
-
-
-
-
-
- {({ getMenuToggleProps }) => {
- return (
-
- Options
-
-
-
- );
- }}
-
-
-
- List item 1
-
-
- List item 2
-
-
- List item 3
-
-
-
-
-```
+{render('./menutoggle')}
Here is an example showcasing the combination of `MenuToggle`, `Popover`, and `Button` components.
-```jsx
-
-
- {({ getMenuToggleProps }) => (
-
-
-
- Options
-
-
-
-
- Popover
-
-
- )}
-
-
-
- List item 1
-
-
- List item 2
-
-
- List item 3
-
-
-
-```
+{render('./menutoggle-popover')}
### MenuToggleIcon
`MenuToggleIcon` is an indicator that indicates the menu is open or closed.
-```jsx
-
-
-
-
-
-
- List item 1
-
-
- List item 2
-
-
- List item 3
-
-
-
-```
+{render('./menutoggleicon')}
You can also customize the indicator by passing a component as children or a function as children that returns a component.
-```jsx
-
- {({ isOpen, direction }) => {
- return (
- <>
-
-
- {(state, { ref, style: styleProps }) => {
- // direction is either 'up' or 'down'
- const icon = `arrow-${direction}`;
- styleProps.transform = isOpen ? 'scaleY(-1)' : 'scaleY(1)';
-
- return (
-
- );
- }}
-
-
-
-
- List item 1
-
-
- List item 2
-
-
- List item 3
-
-
- >
- );
- }}
-
-```
+{render('./menutoggleicon-custom')}
### MenuButton
@@ -544,78 +115,13 @@ const MenuButton = (props) => {
};
```
-```jsx
-
-
- Options
-
-
-
- List item 1
-
-
- List item 2
-
-
- List item 3
-
-
-
-```
+{render('./menubutton')}
### MenuGroup
To group related menu items, wrap them in a `MenuGroup` and pass a `title` prop for the group title.
-```jsx noInline
-const Avatar = (props) => (
-
-);
-
-render(() => (
-
-
- My Profile
-
-
-
- Other profiles
-
-
-
-
-
- )}
- >
-
-
- JD
-
- John Doe
-
-
-
-
-
- Guest
-
-
-
-));
-```
+{render('./menugroup')}
### Menu sizing
@@ -623,89 +129,21 @@ To change the width of the menu, pass `width` prop to the `MenuList` component.
#### fixed width
-```jsx
-
-
- This is a very long menu button
-
-
-
- List item 1
-
-
- List item 2
-
-
- List item 3
-
-
-
-```
+{render('./sizing-fixed-width')}
#### full width
Set `display="block"` on the `Menu` and set `width="100%"` on `MenuButton` and `MenuList` to make the menu as wide as the content.
-```jsx
-
-
- Options
-
-
-
- List item 1
-
-
- List item 2
-
-
- List item 3
-
-
-
-```
+{render('./sizing-full-width')}
#### `min-content`
-```jsx
-
-
- Options
-
-
-
- List item 1
-
-
- List item 2
-
-
- List item 3
-
-
-
-```
+{render('./sizing-min-content')}
#### `max-content`
-```jsx
-
-
- Options
-
-
-
- This is a very long list item 1
-
-
- This is a very long list item 2
-
-
- This is a very long list item 3
-
-
-
-```
+{render('./sizing-max-content')}
### Placement
@@ -719,88 +157,7 @@ The value can be one of the following:
* `bottom-start`
* `bottom-end`
-```jsx noInline
-const useSelection = (defaultValue) => {
- const [value, setValue] = React.useState(defaultValue);
- const changeBy = (value) => () => setValue(value);
- return [value, changeBy];
-};
-
-const gridAreas = [
- ['top-start', 'top', 'top-end'],
- ['.', '.', '.'],
- ['.', 'center', '.'],
- ['.', '.', '.'],
- ['bottom-start', 'bottom', 'bottom-end'],
-];
-
-function Example() {
- const [placement, changePlacementBy] = useSelection('bottom-start');
- const gridTemplateAreas = gridAreas.map((row) => {
- const rowString = '"' + row.join(' ') + '"';
- return rowString;
- }).join(' ');
-
- return (
-
-
- {gridAreas.flat().map((value, key) => {
- if (value === '.') {
- return ( );
- }
-
- if (value === 'center') {
- return (
-
-
-
- Options
-
-
-
- List item 1
-
-
- List item 2
-
-
- List item 3
-
-
-
-
- );
- }
-
- const changePlacement = changePlacementBy(value);
- const onClick = () => {
- changePlacement();
- };
-
- return (
-
-
- {value}
-
-
- );
- })}
-
-
- );
-}
-
-render( );
-```
+{render('./placement')}
### Positioning
@@ -814,127 +171,17 @@ The first number, `skidding`, displaces the menu along the toggle. This value is
The second number, `distance`, controls the distance between the menu and the toggle. This value is specified in pixels.
-```jsx
-
-
- Options
-
-
-
- List item 1
-
-
- List item 2
-
-
- List item 3
-
-
-
-```
+{render('./positioning')}
### Scrolling
To make the menu scrollable, pass `overflow="auto"` and `maxHeight` to `MenuList`. The menu will become scrollable when the menu items exceed the height of the menu.
-```jsx
-
-
- Options
-
-
- {Array.from({ length: 100 }).map((_, key) => (
-
-
-
-
- List Item {key + 1}
-
-
-
-
-
-
- List item
-
-
- List item
-
-
-
- ))}
-
-
-```
+{render('./scrolling-native')}
You can also use the `Scrollbar` component to override the default scrollbar.
-```jsx
-
-
- Options
-
-
-
- {Array.from({ length: 100 }).map((_, key) => (
-
-
-
-
- List Item {key + 1}
-
-
-
-
-
-
- List item
-
-
- List item
-
-
-
- ))}
-
-
-
-```
+{render('./scrolling-scrollbar')}
### Customization
diff --git a/packages/react-docs/pages/components/menu/menubutton.js b/packages/react-docs/pages/components/menu/menubutton.js
new file mode 100644
index 0000000000..c8d1ccfe06
--- /dev/null
+++ b/packages/react-docs/pages/components/menu/menubutton.js
@@ -0,0 +1,23 @@
+import { Menu, MenuButton, MenuItem, MenuList, Text } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+ Options
+
+
+
+ List item 1
+
+
+ List item 2
+
+
+ List item 3
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/menu/menugroup.js b/packages/react-docs/pages/components/menu/menugroup.js
new file mode 100644
index 0000000000..f34de9c615
--- /dev/null
+++ b/packages/react-docs/pages/components/menu/menugroup.js
@@ -0,0 +1,52 @@
+import { ButtonBase, Flex, Icon, MenuDivider, MenuGroup, MenuItem, Space, Text } from '@tonic-ui/react';
+import React from 'react';
+
+const Avatar = (props) => (
+
+);
+
+const App = () => (
+
+
+ My Profile
+
+
+
+ Other profiles
+
+
+
+
+
+ )}
+ >
+
+
+ JD
+
+ John Doe
+
+
+
+
+
+ Guest
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/menu/menutoggle-popover.js b/packages/react-docs/pages/components/menu/menutoggle-popover.js
new file mode 100644
index 0000000000..1ccced1823
--- /dev/null
+++ b/packages/react-docs/pages/components/menu/menutoggle-popover.js
@@ -0,0 +1,44 @@
+import { Button, Menu, MenuItem, MenuList, MenuToggle, MenuToggleIcon, Popover, PopoverContent, PopoverTrigger, Text } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+ {({ getMenuToggleProps }) => (
+
+
+
+ Options
+
+
+
+
+ Popover
+
+
+ )}
+
+
+
+ List item 1
+
+
+ List item 2
+
+
+ List item 3
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/menu/menutoggle.js b/packages/react-docs/pages/components/menu/menutoggle.js
new file mode 100644
index 0000000000..c1ecc96bb0
--- /dev/null
+++ b/packages/react-docs/pages/components/menu/menutoggle.js
@@ -0,0 +1,84 @@
+import { Button, Divider, Flex, Menu, MenuItem, MenuList, MenuToggle, MenuToggleIcon, Space, Text } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+
+ Options
+
+
+
+ List item 1
+
+
+ List item 2
+
+
+ List item 3
+
+
+
+
+
+
+
+ Options
+
+
+
+
+
+
+ List item 1
+
+
+ List item 2
+
+
+ List item 3
+
+
+
+
+
+
+ {({ getMenuToggleProps }) => {
+ return (
+
+ Options
+
+
+
+ );
+ }}
+
+
+
+ List item 1
+
+
+ List item 2
+
+
+ List item 3
+
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/menu/menutoggleicon-custom.js b/packages/react-docs/pages/components/menu/menutoggleicon-custom.js
new file mode 100644
index 0000000000..20b09097f2
--- /dev/null
+++ b/packages/react-docs/pages/components/menu/menutoggleicon-custom.js
@@ -0,0 +1,44 @@
+import { Icon, Menu, MenuItem, MenuList, MenuToggle, MenuToggleIcon } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+ {({ isOpen, direction }) => {
+ return (
+ <>
+
+
+ {(state, { ref, style: styleProps }) => {
+ // direction is either 'up' or 'down'
+ const icon = `arrow-${direction}`;
+ styleProps.transform = isOpen ? 'scaleY(-1)' : 'scaleY(1)';
+
+ return (
+
+ );
+ }}
+
+
+
+
+ List item 1
+
+
+ List item 2
+
+
+ List item 3
+
+
+ >
+ );
+ }}
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/menu/menutoggleicon.js b/packages/react-docs/pages/components/menu/menutoggleicon.js
new file mode 100644
index 0000000000..e83bea3b87
--- /dev/null
+++ b/packages/react-docs/pages/components/menu/menutoggleicon.js
@@ -0,0 +1,23 @@
+import { Menu, MenuItem, MenuList, MenuToggle, MenuToggleIcon } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+
+
+
+
+ List item 1
+
+
+ List item 2
+
+
+ List item 3
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/menu/placement.js b/packages/react-docs/pages/components/menu/placement.js
new file mode 100644
index 0000000000..fce853a0c6
--- /dev/null
+++ b/packages/react-docs/pages/components/menu/placement.js
@@ -0,0 +1,83 @@
+import { Box, Button, Flex, Grid, Menu, MenuButton, MenuItem, MenuList, Text } from '@tonic-ui/react';
+import React, { useState } from 'react';
+
+const useSelection = (defaultValue) => {
+ const [value, setValue] = useState(defaultValue);
+ const changeBy = (value) => () => setValue(value);
+ return [value, changeBy];
+};
+
+const gridAreas = [
+ ['top-start', 'top', 'top-end'],
+ ['.', '.', '.'],
+ ['.', 'center', '.'],
+ ['.', '.', '.'],
+ ['bottom-start', 'bottom', 'bottom-end'],
+];
+
+const App = () => {
+ const [placement, changePlacementBy] = useSelection('bottom-start');
+ const gridTemplateAreas = gridAreas.map((row) => {
+ const rowString = '"' + row.join(' ') + '"';
+ return rowString;
+ }).join(' ');
+
+ return (
+
+
+ {gridAreas.flat().map((value, key) => {
+ if (value === '.') {
+ return ( );
+ }
+
+ if (value === 'center') {
+ return (
+
+
+
+ Options
+
+
+
+ List item 1
+
+
+ List item 2
+
+
+ List item 3
+
+
+
+
+ );
+ }
+
+ const changePlacement = changePlacementBy(value);
+ const onClick = () => {
+ changePlacement();
+ };
+
+ return (
+
+
+ {value}
+
+
+ );
+ })}
+
+
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/menu/positioning.js b/packages/react-docs/pages/components/menu/positioning.js
new file mode 100644
index 0000000000..3a1dfa2a12
--- /dev/null
+++ b/packages/react-docs/pages/components/menu/positioning.js
@@ -0,0 +1,23 @@
+import { Menu, MenuButton, MenuItem, MenuList, Text } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+ Options
+
+
+
+ List item 1
+
+
+ List item 2
+
+
+ List item 3
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/menu/scrolling-native.js b/packages/react-docs/pages/components/menu/scrolling-native.js
new file mode 100644
index 0000000000..b6fae0670b
--- /dev/null
+++ b/packages/react-docs/pages/components/menu/scrolling-native.js
@@ -0,0 +1,51 @@
+import { Flex, Icon, Menu, MenuButton, MenuItem, MenuList, Submenu, SubmenuToggle, SubmenuList, Text } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+ Options
+
+
+ {Array.from({ length: 100 }).map((_, key) => (
+
+
+
+
+ List Item {key + 1}
+
+
+
+
+
+
+ List item
+
+
+ List item
+
+
+
+ ))}
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/menu/scrolling-scrollbar.js b/packages/react-docs/pages/components/menu/scrolling-scrollbar.js
new file mode 100644
index 0000000000..87b9ed4a45
--- /dev/null
+++ b/packages/react-docs/pages/components/menu/scrolling-scrollbar.js
@@ -0,0 +1,54 @@
+import { Flex, Icon, Menu, MenuButton, MenuItem, MenuList, Scrollbar, Submenu, SubmenuList, SubmenuToggle, Text } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+ Options
+
+
+
+ {Array.from({ length: 100 }).map((_, key) => (
+
+
+
+
+ List Item {key + 1}
+
+
+
+
+
+
+ List item
+
+
+ List item
+
+
+
+ ))}
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/menu/sizing-fixed-width.js b/packages/react-docs/pages/components/menu/sizing-fixed-width.js
new file mode 100644
index 0000000000..fb91828fc0
--- /dev/null
+++ b/packages/react-docs/pages/components/menu/sizing-fixed-width.js
@@ -0,0 +1,23 @@
+import { Menu, MenuButton, MenuItem, MenuList, Text } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+ This is a very long menu button
+
+
+
+ List item 1
+
+
+ List item 2
+
+
+ List item 3
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/menu/sizing-full-width.js b/packages/react-docs/pages/components/menu/sizing-full-width.js
new file mode 100644
index 0000000000..f3dd10a662
--- /dev/null
+++ b/packages/react-docs/pages/components/menu/sizing-full-width.js
@@ -0,0 +1,23 @@
+import { Menu, MenuButton, MenuItem, MenuList, Text } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+ Options
+
+
+
+ List item 1
+
+
+ List item 2
+
+
+ List item 3
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/menu/sizing-max-content.js b/packages/react-docs/pages/components/menu/sizing-max-content.js
new file mode 100644
index 0000000000..0ccc1da1bf
--- /dev/null
+++ b/packages/react-docs/pages/components/menu/sizing-max-content.js
@@ -0,0 +1,23 @@
+import { Menu, MenuButton, MenuItem, MenuList, Text } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+ Options
+
+
+
+ This is a very long list item 1
+
+
+ This is a very long list item 2
+
+
+ This is a very long list item 3
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/menu/sizing-min-content.js b/packages/react-docs/pages/components/menu/sizing-min-content.js
new file mode 100644
index 0000000000..3a1ae15dbb
--- /dev/null
+++ b/packages/react-docs/pages/components/menu/sizing-min-content.js
@@ -0,0 +1,23 @@
+import { Menu, MenuButton, MenuItem, MenuList, Text } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+ Options
+
+
+
+ List item 1
+
+
+ List item 2
+
+
+ List item 3
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/menu/uncontrolled.js b/packages/react-docs/pages/components/menu/uncontrolled.js
new file mode 100644
index 0000000000..240a468f82
--- /dev/null
+++ b/packages/react-docs/pages/components/menu/uncontrolled.js
@@ -0,0 +1,61 @@
+import { Flex, Icon, Menu, MenuButton, MenuDivider, MenuItem, MenuList, Submenu, SubmenuList, SubmenuToggle, Text } from '@tonic-ui/react';
+import { isNullish } from '@tonic-ui/utils';
+import React, { useState } from 'react';
+
+const App = () => {
+ const [selectedValue, setSelectedValue] = useState(null);
+ const handleClickMenuItem = (event) => {
+ const value = event.target.getAttribute('value');
+ if (!isNullish(value)) {
+ setSelectedValue(value);
+ }
+ };
+
+ return (
+
+
+
+ Options
+
+
+
+ List item 1
+
+
+ List item 2
+
+
+
+
+
+
+ Submenu
+
+
+
+
+
+
+ List item 3
+
+
+ List item 4
+
+
+
+
+
+ Selected: {selectedValue}
+
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/pagination/basic.js b/packages/react-docs/pages/components/pagination/basic.js
new file mode 100644
index 0000000000..a7fa027f04
--- /dev/null
+++ b/packages/react-docs/pages/components/pagination/basic.js
@@ -0,0 +1,12 @@
+import { Pagination, Stack } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/pagination/controlled-pagination.js b/packages/react-docs/pages/components/pagination/controlled-pagination.js
new file mode 100644
index 0000000000..249d6dd59d
--- /dev/null
+++ b/packages/react-docs/pages/components/pagination/controlled-pagination.js
@@ -0,0 +1,18 @@
+import { Pagination, Stack, Text } from '@tonic-ui/react';
+import React, { useState } from 'react';
+
+const App = () => {
+ const [page, setPage] = useState(1);
+ const handleChange = (event, value) => {
+ setPage(value);
+ };
+
+ return (
+
+ Page: {page}
+
+
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/pagination/customize-the-control-icons.js b/packages/react-docs/pages/components/pagination/customize-the-control-icons.js
new file mode 100644
index 0000000000..bb27aaeb3e
--- /dev/null
+++ b/packages/react-docs/pages/components/pagination/customize-the-control-icons.js
@@ -0,0 +1,27 @@
+import { Icon, Pagination, PaginationItem, Text } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+ {
+ if (props.type === 'start-ellipsis' || props.type === 'end-ellipsis') {
+ return (
+ ...
+ );
+ }
+
+ return (
+ ,
+ next: ,
+ }}
+ {...props}
+ />
+ );
+ }}
+ />
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/pagination/index.page.mdx b/packages/react-docs/pages/components/pagination/index.page.mdx
index df1402d3e9..c00deb6c17 100644
--- a/packages/react-docs/pages/components/pagination/index.page.mdx
+++ b/packages/react-docs/pages/components/pagination/index.page.mdx
@@ -15,182 +15,35 @@ import {
### Basic pagination
-```jsx
-
-
-
-
-
-```
+{render('./basic')}
### Pagination buttons
You can optionally enable or disable first-page, last-page, previous-page, and next-page buttons.
-```jsx
-
-
-
-
-
-```
+{render('./pagination-buttons')}
### Customize the control icons
It's possible to customize the control icons for the start-ellipsis, end-ellipsis, first-page, last-page, previous-page, and next-page buttons.
-```jsx
- {
- if (props.type === 'start-ellipsis' || props.type === 'end-ellipsis') {
- return (
- ...
- );
- }
-
- return (
- ,
- next: ,
- }}
- {...props}
- />
- );
- }}
-/>
-```
+{render('./customize-the-control-icons')}
### Pagination ranges
You can specify how many numbers to display either side of current page with the `siblingCount` prop, and adjacent to the start and end page number with the `boundaryCount` prop.
-```jsx
-
-
-
-
-
-
-
-
-```
+{render('./pagination-ranges')}
### Controlled pagination
-```jsx
-function Example() {
- const [page, setPage] = React.useState(1);
- const handleChange = (event, value) => {
- setPage(value);
- };
-
- return (
-
- Page: {page}
-
- >
- );
-}
-```
+{render('./controlled-pagination')}
### Table pagination
The `Pagination` component is designed to paginate a list of arbitrary items when infinite loading isn't used. For the pagination of a large set of tabular data, you should use the table pagination example as illustrated below.
-```jsx
-function Example() {
- const totalRecords = 400;
- const [page, setPage] = React.useState(1);
- const [perPage, setPerPage] = React.useState(10);
- const totalPages = Math.ceil(totalRecords / perPage);
- const selectPerPage = (value) => {
- setPage(1);
- setPerPage(value);
- };
- const isPrevPageDisabled = (page <= 1);
- const isNextPageDisabled = (page >= totalPages);
- const handleInputChange = (e) => {
- const value = e.target.value;
- if (value <= 1) {
- setPage(1);
- } else if (value >= totalPages) {
- setPage(totalPages);
- } else if (!isNaN(value)) {
- setPage(e.target.value);
- }
- };
-
- return (
-
-
- Total: {totalRecords}
-
-
-
- {perPage} per page
-
- selectPerPage(10)}>10
- selectPerPage(50)}>50
- selectPerPage(100)}>100
-
-
-
-
-
-
- /
-
- {totalPages}
-
- *:not(:first-of-type)': {
- marginLeft: -1
- }
- }}
- >
- {
- const prevPage = page > 1 ? page - 1 : page;
- if (prevPage !== page) {
- setPage(prevPage);
- }
- }}
- >
-
-
- {
- const nextPage = page < totalPages ? page + 1 : page;
- if (nextPage !== page) {
- setPage(nextPage);
- }
- }}
- >
-
-
-
-
- );
-}
-```
+{render('./table-pagination')}
## Props
diff --git a/packages/react-docs/pages/components/pagination/pagination-buttons.js b/packages/react-docs/pages/components/pagination/pagination-buttons.js
new file mode 100644
index 0000000000..e66ccb348c
--- /dev/null
+++ b/packages/react-docs/pages/components/pagination/pagination-buttons.js
@@ -0,0 +1,22 @@
+import { Pagination, Stack } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/pagination/pagination-ranges.js b/packages/react-docs/pages/components/pagination/pagination-ranges.js
new file mode 100644
index 0000000000..ca6c460bd0
--- /dev/null
+++ b/packages/react-docs/pages/components/pagination/pagination-ranges.js
@@ -0,0 +1,15 @@
+import { Pagination, Stack } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+
+
+
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/pagination/table-pagination.js b/packages/react-docs/pages/components/pagination/table-pagination.js
new file mode 100644
index 0000000000..6af1419ea4
--- /dev/null
+++ b/packages/react-docs/pages/components/pagination/table-pagination.js
@@ -0,0 +1,98 @@
+import {
+ Button,
+ ButtonGroup,
+ Divider,
+ Flex,
+ Icon,
+ Input,
+ Menu,
+ MenuButton,
+ MenuItem,
+ MenuList,
+ Space,
+ Text,
+} from '@tonic-ui/react';
+import React, { useState } from 'react';
+
+const App = () => {
+ const totalRecords = 400;
+ const [page, setPage] = useState(1);
+ const [perPage, setPerPage] = useState(10);
+ const totalPages = Math.ceil(totalRecords / perPage);
+ const selectPerPage = (value) => {
+ setPage(1);
+ setPerPage(value);
+ };
+ const isPrevPageDisabled = (page <= 1);
+ const isNextPageDisabled = (page >= totalPages);
+ const handleInputChange = (e) => {
+ const value = e.target.value;
+ if (value <= 1) {
+ setPage(1);
+ } else if (value >= totalPages) {
+ setPage(totalPages);
+ } else if (!isNaN(value)) {
+ setPage(e.target.value);
+ }
+ };
+
+ return (
+
+
+ Total: {totalRecords}
+
+
+
+ {perPage} per page
+
+ selectPerPage(10)}>10
+ selectPerPage(50)}>50
+ selectPerPage(100)}>100
+
+
+
+
+
+
+ /
+
+ {totalPages}
+
+ *:not(:first-of-type)': {
+ marginLeft: -1
+ }
+ }}
+ >
+ {
+ const prevPage = page > 1 ? page - 1 : page;
+ if (prevPage !== page) {
+ setPage(prevPage);
+ }
+ }}
+ >
+
+
+ {
+ const nextPage = page < totalPages ? page + 1 : page;
+ if (nextPage !== page) {
+ setPage(nextPage);
+ }
+ }}
+ >
+
+
+
+
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/pagination/usePagination.js b/packages/react-docs/pages/components/pagination/usePagination.js
new file mode 100644
index 0000000000..f7a86e8994
--- /dev/null
+++ b/packages/react-docs/pages/components/pagination/usePagination.js
@@ -0,0 +1,48 @@
+import { Box, Button, Flex, usePagination } from '@tonic-ui/react';
+import React, { Fragment } from 'react';
+
+const App = () => {
+ const { items } = usePagination({
+ count: 10,
+ slot: {
+ first: true,
+ previous: true,
+ next: true,
+ last: true,
+ },
+ });
+
+ return (
+
+
+ {items.map(({ page, type, selected, ...item }, index) => {
+ let children = null;
+
+ if (type === 'start-ellipsis' || type === 'end-ellipsis') {
+ children = '…';
+ } else if (type === 'page') {
+ children = (
+
+ {page}
+
+ );
+ } else {
+ children = (
+
+ {type}
+
+ );
+ }
+
+ return (
+
+ {children}
+
+ );
+ })}
+
+
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/pagination/usePagination.page.mdx b/packages/react-docs/pages/components/pagination/usePagination.page.mdx
index ef3a2bea14..b87bc0b4ab 100644
--- a/packages/react-docs/pages/components/pagination/usePagination.page.mdx
+++ b/packages/react-docs/pages/components/pagination/usePagination.page.mdx
@@ -33,48 +33,4 @@ Returns an object with the pagination items.
## Demos
-```jsx
-function Example() {
- const { items } = usePagination({
- count: 10,
- slot: {
- first: true,
- previous: true,
- next: true,
- last: true,
- },
- });
-
- return (
-
-
- {items.map(({ page, type, selected, ...item }, index) => {
- let children = null;
-
- if (type === 'start-ellipsis' || type === 'end-ellipsis') {
- children = '…';
- } else if (type === 'page') {
- children = (
-
- {page}
-
- );
- } else {
- children = (
-
- {type}
-
- );
- }
-
- return (
-
- {children}
-
- );
- })}
-
-
- );
-}
-```
+{render('./usePagination')}
diff --git a/packages/react-docs/pages/components/progress.page.mdx b/packages/react-docs/pages/components/progress.page.mdx
deleted file mode 100644
index 806e7626b8..0000000000
--- a/packages/react-docs/pages/components/progress.page.mdx
+++ /dev/null
@@ -1,205 +0,0 @@
-# Progress
-
-Progress indicators inform users about the status of ongoing processes, such as loading an app, submitting a form, or saving updates.
-
-- **Determinate** indicators display how long an operation will take.
-- **Indeterminate** indicators visualize an unspecified wait time.
-
-## Import
-
-```js
-import {
- LinearProgress,
-} from '@tonic-ui/react';
-```
-
-## Usage
-
-```jsx noInline
-const FormGroup = (props) => (
-
-);
-
-const useSelection = (defaultValue) => {
- const [value, setValue] = React.useState(defaultValue);
- const changeBy = (value) => () => setValue(value);
- return [value, changeBy];
-};
-
-render(() => {
- const [variant, changeVariantBy] = useSelection('indeterminate');
- const [size, changeSizeBy] = useSelection('sm');
- const [progress, setProgress] = React.useState(0);
- const resetProgress = React.useCallback(() => setProgress(0), []);
-
- React.useEffect(() => {
- const timer = setInterval(() => {
- setProgress((oldProgress) => {
- if (oldProgress === 100) {
- return 0;
- }
- const diff = 5 + Math.round(Math.random() * 5);
- return Math.min(oldProgress + diff, 100);
- });
- }, 200);
-
- return () => {
- clearInterval(timer);
- };
- }, []);
-
- return (
- <>
-
-
- LinearProgress props
-
-
-
-
-
- variant
-
-
- *:not(:first-of-type)': {
- marginLeft: -1
- }
- }}
- >
- {['indeterminate', 'determinate'].map(value => (
-
- {value}
-
- ))}
-
-
-
-
-
- size
-
-
- *:not(:first-of-type)': {
- marginLeft: -1
- }
- }}
- >
- {['xs', 'sm', 'md', 'lg'].map(value => (
-
- {value}
-
- ))}
-
-
-
-
-
-
-
- {variant === 'determinate' && (
-
- {progress}%
-
- )}
-
- >
- );
-});
-```
-
-### Custom color
-
-You can use the `color` prop to change the color of the progress bar. The default color is `blue:60`.
-
-It accepts a valid CSS background color/image, a color token from the theme, or an array of colors to create a linear gradient.
-
-```jsx
-
- Indeterminate
-
-
-
- Determinate
-
-
- 40%
-
-
-
- 60%
-
-
- Linear gradient
-
-
- blue:60
-
-
- teal:40
-
-
-
-
- 100%
-
-
- Linear gradient with wave light
-
-
- 100%
-
-
-```
-
-## Props
-
-### LinearProgress
-
-| Name | Type | Default | Description |
-| :--- | :--- | :------ | :---------- |
-| color | string \| string[] | 'blue:60' | The color of the progress bar. It accepts a valid CSS background color/image, a color token from the theme, or an array of colors to create a linear gradient. |
-| min | numbner | 0 | The minimum value of the progress. |
-| max | number | 100 | The maximum value of the progress. |
-| size | string | 'sm' | The size of the progress bar. One of: 'xs', 'sm', 'md', 'lg' |
-| variant | string | 'indeterminate' | The variant to use. One of: 'indeterminate', 'determinate' • Use indeterminate when there is no progress value. • Use determinate when a progress value is defined. |
-| value | number | | The value of the progress indicator for the determinate variant. |
diff --git a/packages/react-docs/pages/components/progress/custom-color.js b/packages/react-docs/pages/components/progress/custom-color.js
new file mode 100644
index 0000000000..172fc214ef
--- /dev/null
+++ b/packages/react-docs/pages/components/progress/custom-color.js
@@ -0,0 +1,59 @@
+import { Box, Divider, Flex, LinearProgress, Stack, TextLabel } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+ Indeterminate
+
+
+
+ Determinate
+
+
+ 40%
+
+
+
+ 60%
+
+
+ Linear gradient
+
+
+ blue:60
+
+
+ teal:40
+
+
+
+
+ 100%
+
+
+ Linear gradient with wave light
+
+
+ 100%
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/progress/index.page.mdx b/packages/react-docs/pages/components/progress/index.page.mdx
new file mode 100644
index 0000000000..160cb51f1d
--- /dev/null
+++ b/packages/react-docs/pages/components/progress/index.page.mdx
@@ -0,0 +1,39 @@
+# Progress
+
+Progress indicators inform users about the status of ongoing processes, such as loading an app, submitting a form, or saving updates.
+
+- **Determinate** indicators display how long an operation will take.
+- **Indeterminate** indicators visualize an unspecified wait time.
+
+## Import
+
+```js
+import {
+ LinearProgress,
+} from '@tonic-ui/react';
+```
+
+## Usage
+
+{render('./usage')}
+
+### Custom color
+
+You can use the `color` prop to change the color of the progress bar. The default color is `blue:60`.
+
+It accepts a valid CSS background color/image, a color token from the theme, or an array of colors to create a linear gradient.
+
+{render('./custom-color')}
+
+## Props
+
+### LinearProgress
+
+| Name | Type | Default | Description |
+| :--- | :--- | :------ | :---------- |
+| color | string \| string[] | 'blue:60' | The color of the progress bar. It accepts a valid CSS background color/image, a color token from the theme, or an array of colors to create a linear gradient. |
+| min | numbner | 0 | The minimum value of the progress. |
+| max | number | 100 | The maximum value of the progress. |
+| size | string | 'sm' | The size of the progress bar. One of: 'xs', 'sm', 'md', 'lg' |
+| variant | string | 'indeterminate' | The variant to use. One of: 'indeterminate', 'determinate' • Use indeterminate when there is no progress value. • Use determinate when a progress value is defined. |
+| value | number | | The value of the progress indicator for the determinate variant. |
diff --git a/packages/react-docs/pages/components/progress/usage.js b/packages/react-docs/pages/components/progress/usage.js
new file mode 100644
index 0000000000..4d6b58f958
--- /dev/null
+++ b/packages/react-docs/pages/components/progress/usage.js
@@ -0,0 +1,118 @@
+import { Box, Button, ButtonGroup, Divider, Flex, LinearProgress, Text, TextLabel } from '@tonic-ui/react';
+import { callAll } from '@tonic-ui/utils';
+import React, { useCallback, useEffect, useState } from 'react';
+
+const FormGroup = (props) => (
+
+);
+
+const useSelection = (defaultValue) => {
+ const [value, setValue] = React.useState(defaultValue);
+ const changeBy = (value) => () => setValue(value);
+ return [value, changeBy];
+};
+
+const App = () => {
+ const [variant, changeVariantBy] = useSelection('indeterminate');
+ const [size, changeSizeBy] = useSelection('sm');
+ const [progress, setProgress] = useState(0);
+ const resetProgress = useCallback(() => setProgress(0), []);
+
+ useEffect(() => {
+ const timer = setInterval(() => {
+ setProgress((oldProgress) => {
+ if (oldProgress === 100) {
+ return 0;
+ }
+ const diff = 5 + Math.round(Math.random() * 5);
+ return Math.min(oldProgress + diff, 100);
+ });
+ }, 200);
+
+ return () => {
+ clearInterval(timer);
+ };
+ }, []);
+
+ return (
+ <>
+
+
+ LinearProgress props
+
+
+
+
+
+ variant
+
+
+ *:not(:first-of-type)': {
+ marginLeft: -1
+ }
+ }}
+ >
+ {['indeterminate', 'determinate'].map(value => (
+
+ {value}
+
+ ))}
+
+
+
+
+
+ size
+
+
+ *:not(:first-of-type)': {
+ marginLeft: -1
+ }
+ }}
+ >
+ {['xs', 'sm', 'md', 'lg'].map(value => (
+
+ {value}
+
+ ))}
+
+
+
+
+
+
+
+ {variant === 'determinate' && (
+
+ {progress}%
+
+ )}
+
+ >
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/radio-group.page.mdx b/packages/react-docs/pages/components/radio-group.page.mdx
deleted file mode 100644
index 0eeded3841..0000000000
--- a/packages/react-docs/pages/components/radio-group.page.mdx
+++ /dev/null
@@ -1,197 +0,0 @@
-# RadioGroup
-
-`RadioGroup` is used to group related radio buttons.
-
-## Import
-
-```js
-import { RadioGroup } from '@tonic-ui/react';
-```
-
-### Usage
-
-#### Uncontrolled radio group
-
-```jsx
-
-
- First
- Second
- Third
-
-
-```
-
-#### Controlled radio group
-
-```jsx
-function Example() {
- const [value, setValue] = React.useState('1');
-
- return (
- setValue(value)}>
-
- First
- Second
- Third
-
-
- );
-}
-```
-
-### Group orientation
-
-Make a set of radios appear horizontal stacked rather than vertically, by adding `flexDirection="row"` to the `Stack` component.
-
-```jsx
-
-
- Radio 1
- Radio 2
- Radio 3
-
-
-```
-
-### Colors
-
-Use the `variantColor` prop to change the color scheme of the Radio. `variantColor` can be any color key with key `50`(hover), `60`(checked) that exist in the `theme.colors`.
-
-```jsx
-
-
- Radio 1
- Radio 2
-
-
-```
-
-### Sizes
-
-Use the `size` prop to change the size of the `RadioGroup`. You can set the value to `sm`, `md`, or `lg`.
-
-```jsx
-
-
-
- Radio 1
- Radio 2
- Radio 3
-
-
-
-
- Radio 1
- Radio 2
- Radio 3
-
-
-
-
- Radio 1
- Radio 2
- Radio 3
-
-
-
-```
-
-### States
-
-```jsx
-
-
-
- Radio 1
- Radio 2
- Radio 3
-
-
-
-
- Radio 1
- Radio 2
- Radio 3
-
-
-
-```
-
-### Asynchronous data loading
-
-```jsx
-function Example() {
- const [state, setState] = React.useState({
- state: 'idle',
- value: null,
- });
- const timerRef = React.useRef(null);
- const fetchData = React.useCallback(() => {
- setState(prevState => ({
- ...prevState,
- state: 'loading',
- value: null,
- }));
-
- if (timerRef.current) {
- clearTimeout(timerRef.current);
- timerRef.current = null;
- }
- timerRef.current = setTimeout(() => {
- setState({
- state: 'success',
- value: '1',
- });
-
- timerRef.current = null;
- }, 2000);
- }, []);
-
- React.useEffect(() => {
- fetchData();
- }, [fetchData]);
-
- return (
- <>
-
- fetchData()}>
-
-
-
- Reload
-
-
-
- {
- setState(prevState => ({ ...prevState, value: nextValue }));
- }}
- >
-
- First
- Second
- Third
-
-
- >
- );
-}
-```
-
-## Props
-
-### RadioGroup
-
-| Name | Type | Default | Description |
-| :--- | :--- | :------ | :---------- |
-| children | ReactNode \| `(context) => ReactNode` | | A function child can be used intead of a React element. This function is called with the context object. |
-| defaultValue | string \| number | | The default `input` element value. Use when the component is not controlled. |
-| disabled | boolean | false | If `true`, all radios will be disabled. |
-| name | string | | The name used to reference the value of the control. If you don't provide this prop, it falls back to a randomly generated name. |
-| onChange | function | | A callback called when the state of the radio changes. |
-| size | string | 'md' | The size (width and height) of the radio. One of: 'sm', 'md', 'lg' |
-| value | string \| number | | The value to be used in the radio input. This is the value that will be returned on form submission. |
-| variantColor | string | | The color of the radio when it's checked. This should be one of the color keys in the theme (e.g. 'green', 'red'). |
diff --git a/packages/react-docs/pages/components/radio-group/asynchronous-data-loading.js b/packages/react-docs/pages/components/radio-group/asynchronous-data-loading.js
new file mode 100644
index 0000000000..d3841c2ea5
--- /dev/null
+++ b/packages/react-docs/pages/components/radio-group/asynchronous-data-loading.js
@@ -0,0 +1,63 @@
+import { Box, Flex, Icon, LinkButton, Radio, RadioGroup, Space, Stack } from '@tonic-ui/react';
+import React, { useCallback, useEffect, useRef, useState } from 'react';
+
+const App = () => {
+ const [state, setState] = useState({
+ state: 'idle',
+ value: null,
+ });
+ const timerRef = useRef(null);
+ const fetchData = useCallback(() => {
+ setState(prevState => ({
+ ...prevState,
+ state: 'loading',
+ value: null,
+ }));
+
+ if (timerRef.current) {
+ clearTimeout(timerRef.current);
+ timerRef.current = null;
+ }
+ timerRef.current = setTimeout(() => {
+ setState({
+ state: 'success',
+ value: '1',
+ });
+
+ timerRef.current = null;
+ }, 2000);
+ }, []);
+
+ useEffect(() => {
+ fetchData();
+ }, [fetchData]);
+
+ return (
+ <>
+
+ fetchData()}>
+
+
+
+ Reload
+
+
+
+ {
+ setState(prevState => ({ ...prevState, value: nextValue }));
+ }}
+ >
+
+ First
+ Second
+ Third
+
+
+ >
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/radio-group/colors.js b/packages/react-docs/pages/components/radio-group/colors.js
new file mode 100644
index 0000000000..36917bbcd3
--- /dev/null
+++ b/packages/react-docs/pages/components/radio-group/colors.js
@@ -0,0 +1,13 @@
+import { Radio, RadioGroup, Stack } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+ Radio 1
+ Radio 2
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/radio-group/controlled-radio-group.js b/packages/react-docs/pages/components/radio-group/controlled-radio-group.js
new file mode 100644
index 0000000000..31515bf064
--- /dev/null
+++ b/packages/react-docs/pages/components/radio-group/controlled-radio-group.js
@@ -0,0 +1,18 @@
+import { Radio, RadioGroup, Stack } from '@tonic-ui/react';
+import React, { useState } from 'react';
+
+const App = () => {
+ const [value, setValue] = useState('1');
+
+ return (
+ setValue(value)}>
+
+ First
+ Second
+ Third
+
+
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/radio-group/group-orientation.js b/packages/react-docs/pages/components/radio-group/group-orientation.js
new file mode 100644
index 0000000000..c1e2a592b7
--- /dev/null
+++ b/packages/react-docs/pages/components/radio-group/group-orientation.js
@@ -0,0 +1,14 @@
+import { Radio, RadioGroup, Stack } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+ Radio 1
+ Radio 2
+ Radio 3
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/radio-group/index.page.mdx b/packages/react-docs/pages/components/radio-group/index.page.mdx
new file mode 100644
index 0000000000..a339bab527
--- /dev/null
+++ b/packages/react-docs/pages/components/radio-group/index.page.mdx
@@ -0,0 +1,60 @@
+# RadioGroup
+
+`RadioGroup` is used to group related radio buttons.
+
+## Import
+
+```js
+import { RadioGroup } from '@tonic-ui/react';
+```
+
+### Usage
+
+#### Uncontrolled radio group
+
+{render('./uncontrolled-radio-group')}
+
+#### Controlled radio group
+
+{render('./controlled-radio-group')}
+
+### Group orientation
+
+Make a set of radios appear horizontal stacked rather than vertically, by adding `flexDirection="row"` to the `Stack` component.
+
+{render('./group-orientation')}
+
+### Colors
+
+Use the `variantColor` prop to change the color scheme of the Radio. `variantColor` can be any color key with key `50`(hover), `60`(checked) that exist in the `theme.colors`.
+
+{render('./colors')}
+
+### Sizes
+
+Use the `size` prop to change the size of the `RadioGroup`. You can set the value to `sm`, `md`, or `lg`.
+
+{render('./sizes')}
+
+### States
+
+{render('./states')}
+
+### Asynchronous data loading
+
+{render('./asynchronous-data-loading')}
+
+## Props
+
+### RadioGroup
+
+| Name | Type | Default | Description |
+| :--- | :--- | :------ | :---------- |
+| children | ReactNode \| `(context) => ReactNode` | | A function child can be used intead of a React element. This function is called with the context object. |
+| defaultValue | string \| number | | The default `input` element value. Use when the component is not controlled. |
+| disabled | boolean | false | If `true`, all radios will be disabled. |
+| name | string | | The name used to reference the value of the control. If you don't provide this prop, it falls back to a randomly generated name. |
+| onChange | function | | A callback called when the state of the radio changes. |
+| size | string | 'md' | The size (width and height) of the radio. One of: 'sm', 'md', 'lg' |
+| value | string \| number | | The value to be used in the radio input. This is the value that will be returned on form submission. |
+| variantColor | string | | The color of the radio when it's checked. This should be one of the color keys in the theme (e.g. 'green', 'red'). |
diff --git a/packages/react-docs/pages/components/radio-group/sizes.js b/packages/react-docs/pages/components/radio-group/sizes.js
new file mode 100644
index 0000000000..5fbfd984da
--- /dev/null
+++ b/packages/react-docs/pages/components/radio-group/sizes.js
@@ -0,0 +1,30 @@
+import { Radio, RadioGroup, Stack } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+
+ Radio 1
+ Radio 2
+ Radio 3
+
+
+
+
+ Radio 1
+ Radio 2
+ Radio 3
+
+
+
+
+ Radio 1
+ Radio 2
+ Radio 3
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/radio-group/states.js b/packages/react-docs/pages/components/radio-group/states.js
new file mode 100644
index 0000000000..f23c2537e0
--- /dev/null
+++ b/packages/react-docs/pages/components/radio-group/states.js
@@ -0,0 +1,23 @@
+import { Radio, RadioGroup, Stack } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+
+ Radio 1
+ Radio 2
+ Radio 3
+
+
+
+
+ Radio 1
+ Radio 2
+ Radio 3
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/radio-group/uncontrolled-radio-group.js b/packages/react-docs/pages/components/radio-group/uncontrolled-radio-group.js
new file mode 100644
index 0000000000..f7cb8d3776
--- /dev/null
+++ b/packages/react-docs/pages/components/radio-group/uncontrolled-radio-group.js
@@ -0,0 +1,14 @@
+import { Radio, RadioGroup, Stack } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+ First
+ Second
+ Third
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/radio/accessibility.js b/packages/react-docs/pages/components/radio/accessibility.js
new file mode 100644
index 0000000000..3e68e2a282
--- /dev/null
+++ b/packages/react-docs/pages/components/radio/accessibility.js
@@ -0,0 +1,12 @@
+import { Radio } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+);
+
+export default App;
\ No newline at end of file
diff --git a/packages/react-docs/pages/components/radio/basic.js b/packages/react-docs/pages/components/radio/basic.js
new file mode 100644
index 0000000000..797ca631d6
--- /dev/null
+++ b/packages/react-docs/pages/components/radio/basic.js
@@ -0,0 +1,10 @@
+import { Radio } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+ Label
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/radio/colors.js b/packages/react-docs/pages/components/radio/colors.js
new file mode 100644
index 0000000000..ef0106f37d
--- /dev/null
+++ b/packages/react-docs/pages/components/radio/colors.js
@@ -0,0 +1,15 @@
+import { Flex, Radio } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+ Label
+
+
+ Label
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/radio/faq-input-ref.js b/packages/react-docs/pages/components/radio/faq-input-ref.js
new file mode 100644
index 0000000000..2fc1ee8838
--- /dev/null
+++ b/packages/react-docs/pages/components/radio/faq-input-ref.js
@@ -0,0 +1,23 @@
+import { Button, Flex, Radio } from '@tonic-ui/react';
+import React, { useCallback, useRef } from 'react';
+
+const App = () => {
+ const inputRef = useRef();
+ const handleClick = useCallback(() => {
+ inputRef.current.focus();
+ console.log(inputRef.current.checked); // => true
+ }, []);
+
+ return (
+
+
+ Label
+
+
+ Click Me
+
+
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/radio/flex-container.js b/packages/react-docs/pages/components/radio/flex-container.js
new file mode 100644
index 0000000000..c4710940ab
--- /dev/null
+++ b/packages/react-docs/pages/components/radio/flex-container.js
@@ -0,0 +1,23 @@
+import { Box, Flex, Radio, Text } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+
+
+
+ Label
+ Helper text
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/radio.page.mdx b/packages/react-docs/pages/components/radio/index.page.mdx
similarity index 70%
rename from packages/react-docs/pages/components/radio.page.mdx
rename to packages/react-docs/pages/components/radio/index.page.mdx
index 0ac119d30a..b72e6f7bd4 100644
--- a/packages/react-docs/pages/components/radio.page.mdx
+++ b/packages/react-docs/pages/components/radio/index.page.mdx
@@ -10,88 +10,27 @@ import { Radio } from '@tonic-ui/react';
## Usage
-```jsx
-
- Label
-
-```
+{render('./basic')}
You can use a flex container to align a radio button with other components. This allows you to easily control the positioning and spacing of all elements within the container.
-```jsx
-
-
-
-
-
- Label
- Helper text
-
-
-```
+{render('./flex-container')}
### Colors
Use the `variantColor` prop to change the color scheme of a radio button. `variantColor` can be any color key with key `50` (hover) or `60` (checked) that exist in `theme.colors`.
-```jsx
-
-
- Label
-
-
- Label
-
-
-```
+{render('./colors')}
### Sizes
Use the `size` prop to change the radio button size. You can set the value to `sm`, `md`, or `lg`.
-```jsx
-
-
- Label
-
-
- Label
-
-
- Label
-
-
-```
+{render('./sizes')}
### States
-```jsx
-
-
-
- Label
-
-
- Label
-
-
-
-
- Label
-
-
- Label
-
-
-
-```
+{render('./states')}
## Accessibility
@@ -118,27 +57,7 @@ Once you have obtained the reference to the input element, you can access its pr
Here's an example of how you can utilize the `inputRef` prop to access the input element and perform actions:
-```jsx
-function Example() {
- const inputRef = React.useRef();
-
- const handleClick = () => {
- inputRef.current.focus();
- console.log(inputRef.current.checked); // => true
- };
-
- return (
-
-
- Label
-
-
- Click Me
-
-
- );
-}
-```
+{render('./faq-input-ref')}
## Props
diff --git a/packages/react-docs/pages/components/radio/sizes.js b/packages/react-docs/pages/components/radio/sizes.js
new file mode 100644
index 0000000000..c6a2a69276
--- /dev/null
+++ b/packages/react-docs/pages/components/radio/sizes.js
@@ -0,0 +1,18 @@
+import { Flex, Radio } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+ Label
+
+
+ Label
+
+
+ Label
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/radio/states.js b/packages/react-docs/pages/components/radio/states.js
new file mode 100644
index 0000000000..28b4c5be93
--- /dev/null
+++ b/packages/react-docs/pages/components/radio/states.js
@@ -0,0 +1,25 @@
+import { Flex, Radio, Stack } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+
+ Label
+
+
+ Label
+
+
+
+
+ Label
+
+
+ Label
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/search-input.page.mdx b/packages/react-docs/pages/components/search-input.page.mdx
deleted file mode 100644
index 57b8c8a5a7..0000000000
--- a/packages/react-docs/pages/components/search-input.page.mdx
+++ /dev/null
@@ -1,209 +0,0 @@
-# SearchInput
-
-## Import
-
-```js
-import { SearchInput } from '@tonic-ui/react';
-```
-
-## Usage
-
-```jsx
-
-
-
-
-
-
-
-
-```
-
-### Keyword search
-
-This example shows how to create a keyword search component with the following features:
-- Automatically adjust the width of an input element
-- Handle focus and blur events
-- Trigger search when pressed `Enter` key
-- Display a loading indicator that recognizes the loading state
-
-```jsx
-function Example() {
- const ref = React.useRef();
- const [placeholder, setPlaceholder] = React.useState('Search');
- const [inputWidth, setInputWidth] = React.useState(180);
- const [keyword, setKeyword] = React.useState('');
- const [isLoading, setIsLoading] = React.useState(false);
- const searchKeyword = (keyword) => {
- setIsLoading(true);
- setTimeout(() => {
- setIsLoading(false);
- }, 3000);
- };
- const onChange = (e) => {
- const keyword = e.target.value;
- setKeyword(keyword);
- };
- const onClearInput = (e) => {
- setKeyword('');
- };
- const onKeyPress = (e) => {
- if (e.key === 'Enter') {
- const keyword = e.target.value;
- if (!!keyword) {
- searchKeyword(keyword);
- }
- }
- };
- const handleClickReset = (e) => {
- setKeyword('');
- if (isLoading) {
- setIsLoading(false);
- }
- };
-
- return (
-
- {
- setPlaceholder('Company name, endpoint name');
- setInputWidth(360);
-
- requestAnimationFrame(() => {
- ref.current.select();
- });
- }}
- onBlur={() => {
- setPlaceholder('Search');
- // Shrink width when the value is empty
- setInputWidth(!!keyword ? 360 : 180);
- }}
- onKeyPress={onKeyPress}
- width={inputWidth}
- inputProps={{
- textOverflow: 'ellipsis',
- }}
- />
-
- Reset
-
-
- );
-}
-```
-
-### Sizes
-
-Use the `size` prop to change the size of the `SearchInput`. You can set the value to `sm`, `md`, or `lg`.
-
-```jsx
-
-
-
-
-
-```
-
-### Variants
-
-The `SearchInput` component comes in 3 variants: `outline`, `filled`, `flush`, and `unstyled`. Pass the `variant` prop and set it to either of these values.
-
-#### `outline`
-
-```jsx
-
-```
-
-#### `filled`
-
-```jsx
-
-```
-
-#### `flush`
-
-```jsx
-
-```
-
-#### `unstyled`
-
-```jsx
-
-```
-
-### Attributes
-
-Standard input attributes are supported, e.g., `disabled`, `readOnly`, `required`, etc.
-
-#### `disabled`
-
-```jsx
-
-
-
-
-```
-
-#### `readOnly`
-
-```jsx
-
-
-
-
-```
-
-#### `required`
-
-```jsx
-
-```
-
-## Props
-
-### SearchInput
-
-| Name | Type | Default | Description |
-| :--- | :--- | :------ | :---------- |
-| disabled | boolean | | If `true`, the input is disabled and the user cannot interact with it. |
-| error | boolean | | If `true`, the input displays a red border to indicate an error. |
-| isLoading | boolean | | If `true`, a loading spinner is displayed inside the input field. |
-| onChange | function | | A callback called when the value is changed. |
-| onClearInput | function | | A callback called when the clear button is clicked. |
-| readOnly | boolean | | If `true`, the value of the input cannot be edited. |
-| size | string | 'md' | The visual size of the `input` element. One of: 'sm', 'md', 'lg' |
-| variant | string | 'outline' | The variant of the input style to use. One of: 'outline', 'filled', 'flush', 'unstyled' |
diff --git a/packages/react-docs/pages/components/search-input/attribute-disabled.js b/packages/react-docs/pages/components/search-input/attribute-disabled.js
new file mode 100644
index 0000000000..9f3f1c153d
--- /dev/null
+++ b/packages/react-docs/pages/components/search-input/attribute-disabled.js
@@ -0,0 +1,11 @@
+import { SearchInput, Stack } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/search-input/attribute-readonly.js b/packages/react-docs/pages/components/search-input/attribute-readonly.js
new file mode 100644
index 0000000000..86868a8a46
--- /dev/null
+++ b/packages/react-docs/pages/components/search-input/attribute-readonly.js
@@ -0,0 +1,11 @@
+import { SearchInput, Stack } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/search-input/attribute-required.js b/packages/react-docs/pages/components/search-input/attribute-required.js
new file mode 100644
index 0000000000..0a60dcf700
--- /dev/null
+++ b/packages/react-docs/pages/components/search-input/attribute-required.js
@@ -0,0 +1,8 @@
+import { SearchInput } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/search-input/basic.js b/packages/react-docs/pages/components/search-input/basic.js
new file mode 100644
index 0000000000..a8401a96bf
--- /dev/null
+++ b/packages/react-docs/pages/components/search-input/basic.js
@@ -0,0 +1,38 @@
+import { SearchInput, Stack } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+
+
+
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/search-input/index.page.mdx b/packages/react-docs/pages/components/search-input/index.page.mdx
new file mode 100644
index 0000000000..1df7998a57
--- /dev/null
+++ b/packages/react-docs/pages/components/search-input/index.page.mdx
@@ -0,0 +1,78 @@
+# SearchInput
+
+## Import
+
+```js
+import { SearchInput } from '@tonic-ui/react';
+```
+
+## Usage
+
+{render('./basic')}
+
+### Keyword search
+
+This example shows how to create a keyword search component with the following features:
+- Automatically adjust the width of an input element
+- Handle focus and blur events
+- Trigger search when pressed `Enter` key
+- Display a loading indicator that recognizes the loading state
+
+{render('./keyword-search')}
+
+### Sizes
+
+Use the `size` prop to change the size of the `SearchInput`. You can set the value to `sm`, `md`, or `lg`.
+
+{render('./sizes')}
+
+### Variants
+
+The `SearchInput` component comes in 3 variants: `outline`, `filled`, `flush`, and `unstyled`. Pass the `variant` prop and set it to either of these values.
+
+#### `outline`
+
+{render('./variant-outline')}
+
+#### `filled`
+
+{render('./variant-filled')}
+
+#### `flush`
+
+{render('./variant-flush')}
+
+#### `unstyled`
+
+{render('./variant-unstyled')}
+
+### Attributes
+
+Standard input attributes are supported, e.g., `disabled`, `readOnly`, `required`, etc.
+
+#### `disabled`
+
+{render('./attribute-disabled')}
+
+#### `readOnly`
+
+{render('./attribute-readonly')}
+
+#### `required`
+
+{render('./attribute-required')}
+
+## Props
+
+### SearchInput
+
+| Name | Type | Default | Description |
+| :--- | :--- | :------ | :---------- |
+| disabled | boolean | | If `true`, the input is disabled and the user cannot interact with it. |
+| error | boolean | | If `true`, the input displays a red border to indicate an error. |
+| isLoading | boolean | | If `true`, a loading spinner is displayed inside the input field. |
+| onChange | function | | A callback called when the value is changed. |
+| onClearInput | function | | A callback called when the clear button is clicked. |
+| readOnly | boolean | | If `true`, the value of the input cannot be edited. |
+| size | string | 'md' | The visual size of the `input` element. One of: 'sm', 'md', 'lg' |
+| variant | string | 'outline' | The variant of the input style to use. One of: 'outline', 'filled', 'flush', 'unstyled' |
diff --git a/packages/react-docs/pages/components/search-input/keyword-search.js b/packages/react-docs/pages/components/search-input/keyword-search.js
new file mode 100644
index 0000000000..b04eee68fb
--- /dev/null
+++ b/packages/react-docs/pages/components/search-input/keyword-search.js
@@ -0,0 +1,77 @@
+import { Button, Flex, SearchInput } from '@tonic-ui/react';
+import React, { useRef, useState } from 'react';
+
+const App = () => {
+ const ref = useRef();
+ const [placeholder, setPlaceholder] = useState('Search');
+ const [inputWidth, setInputWidth] = useState(180);
+ const [keyword, setKeyword] = useState('');
+ const [isLoading, setIsLoading] = useState(false);
+ const searchKeyword = (keyword) => {
+ setIsLoading(true);
+ setTimeout(() => {
+ setIsLoading(false);
+ }, 3000);
+ };
+ const onChange = (e) => {
+ const keyword = e.target.value;
+ setKeyword(keyword);
+ };
+ const onClearInput = (e) => {
+ setKeyword('');
+ };
+ const onKeyPress = (e) => {
+ if (e.key === 'Enter') {
+ const keyword = e.target.value;
+ if (keyword) {
+ searchKeyword(keyword);
+ }
+ }
+ };
+ const handleClickReset = (e) => {
+ setKeyword('');
+ if (isLoading) {
+ setIsLoading(false);
+ }
+ };
+
+ return (
+
+ {
+ setPlaceholder('Company name, endpoint name');
+ setInputWidth(360);
+
+ requestAnimationFrame(() => {
+ ref.current.select();
+ });
+ }}
+ onBlur={() => {
+ setPlaceholder('Search');
+ // Shrink width when the value is empty
+ setInputWidth(keyword ? 360 : 180);
+ }}
+ onKeyPress={onKeyPress}
+ width={inputWidth}
+ inputProps={{
+ textOverflow: 'ellipsis',
+ }}
+ />
+
+ Reset
+
+
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/search-input/sizes.js b/packages/react-docs/pages/components/search-input/sizes.js
new file mode 100644
index 0000000000..878f668587
--- /dev/null
+++ b/packages/react-docs/pages/components/search-input/sizes.js
@@ -0,0 +1,12 @@
+import { SearchInput, Stack } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/search-input/variant-filled.js b/packages/react-docs/pages/components/search-input/variant-filled.js
new file mode 100644
index 0000000000..ea2612d1de
--- /dev/null
+++ b/packages/react-docs/pages/components/search-input/variant-filled.js
@@ -0,0 +1,8 @@
+import { SearchInput } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/search-input/variant-flush.js b/packages/react-docs/pages/components/search-input/variant-flush.js
new file mode 100644
index 0000000000..923c144a3b
--- /dev/null
+++ b/packages/react-docs/pages/components/search-input/variant-flush.js
@@ -0,0 +1,8 @@
+import { SearchInput } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/search-input/variant-outline.js b/packages/react-docs/pages/components/search-input/variant-outline.js
new file mode 100644
index 0000000000..915b7a1e21
--- /dev/null
+++ b/packages/react-docs/pages/components/search-input/variant-outline.js
@@ -0,0 +1,8 @@
+import { SearchInput } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/search-input/variant-unstyled.js b/packages/react-docs/pages/components/search-input/variant-unstyled.js
new file mode 100644
index 0000000000..5164e38471
--- /dev/null
+++ b/packages/react-docs/pages/components/search-input/variant-unstyled.js
@@ -0,0 +1,8 @@
+import { SearchInput } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/select.page.mdx b/packages/react-docs/pages/components/select.page.mdx
deleted file mode 100644
index 5cf94c66af..0000000000
--- a/packages/react-docs/pages/components/select.page.mdx
+++ /dev/null
@@ -1,136 +0,0 @@
-# Select
-
-The `Select` component is used for collecting user provided information from a list of options.
-
-## Import
-
-```js
-import {
- Select,
- Option,
- OptionGroup,
-} from '@tonic-ui/react';
-```
-
-## Usage
-
-```jsx
-<>
- Label:
-
- Choose an option
-
- Option 1
- Option 2
-
-
- Option 3
- Option 4
-
-
->
-```
-
-### Variants
-
-The `Select` component comes in 3 variants: `outline`, `filled`, and `unstyled`. Pass the `variant` prop and set it to either of these values.
-
-#### `outline`
-
-```jsx
-
- Choose an option
- Outline
-
-```
-
-#### `filled`
-
-```jsx
-
- Choose an option
- Filled
-
-```
-
-#### `unstyled`
-
-```jsx
-
- Choose an option
- Unstyled
-
-```
-
-### Attributes
-
-The `` element has some unique attributes you can use to control it, such as `multiple` to specify whether multiple options can be selected, and `size` to specify how many options should be shown at once. It also accepts most of the general form input attributes such as `disabled`, `required`, etc.
-
-#### Multiple options
-
-```jsx noInline
-const FlexOption = ({ style, ...props }) => (
-
-);
-
-function Example() {
- return (
-
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
-
- );
-}
-
-render( );
-```
-
-#### `disabled`
-
-```jsx
-
- Choose an option
-
-```
-
-#### `required`
-
-```jsx
-
- Choose an option
- Dog
- Cat
-
-```
-
-## Props
-
-### Select
-
-| Name | Type | Default | Description |
-| :--- | :--- | :------ | :---------- |
-| disabled | boolean | | If `true`, the select is disabled and the user cannot interact with it. |
-| error | boolean | | If `true`, the select displays a red border to indicate an error. |
-| variant | string | 'outline' | The variant of the select style to use. One of: 'outline', 'filled', 'unstyled' |
-
-### Option
-
-| Name | Type | Default | Description |
-| :--- | :--- | :------ | :---------- |
-| children | ReactNode | | |
-
-### OptionGroup
-
-| Name | Type | Default | Description |
-| :--- | :--- | :------ | :---------- |
-| children | ReactNode | | |
diff --git a/packages/react-docs/pages/components/select/attribute-disabled.js b/packages/react-docs/pages/components/select/attribute-disabled.js
new file mode 100644
index 0000000000..66e2370a17
--- /dev/null
+++ b/packages/react-docs/pages/components/select/attribute-disabled.js
@@ -0,0 +1,10 @@
+import { Option, Select } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+ Choose an option
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/select/attribute-required.js b/packages/react-docs/pages/components/select/attribute-required.js
new file mode 100644
index 0000000000..f9aed895bf
--- /dev/null
+++ b/packages/react-docs/pages/components/select/attribute-required.js
@@ -0,0 +1,12 @@
+import { Option, Select } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+ Choose an option
+ Dog
+ Cat
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/select/basic.js b/packages/react-docs/pages/components/select/basic.js
new file mode 100644
index 0000000000..1714bc3bf2
--- /dev/null
+++ b/packages/react-docs/pages/components/select/basic.js
@@ -0,0 +1,21 @@
+import { Option, OptionGroup, Select, TextLabel } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+ <>
+ Label:
+
+ Choose an option
+
+ Option 1
+ Option 2
+
+
+ Option 3
+ Option 4
+
+
+ >
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/select/index.page.mdx b/packages/react-docs/pages/components/select/index.page.mdx
new file mode 100644
index 0000000000..2402f6d353
--- /dev/null
+++ b/packages/react-docs/pages/components/select/index.page.mdx
@@ -0,0 +1,71 @@
+# Select
+
+The `Select` component is used for collecting user provided information from a list of options.
+
+## Import
+
+```js
+import {
+ Select,
+ Option,
+ OptionGroup,
+} from '@tonic-ui/react';
+```
+
+## Usage
+
+{render('./basic')}
+
+### Variants
+
+The `Select` component comes in 3 variants: `outline`, `filled`, and `unstyled`. Pass the `variant` prop and set it to either of these values.
+
+#### `outline`
+
+{render('./variant-outline')}
+
+#### `filled`
+
+{render('./variant-filled')}
+
+#### `unstyled`
+
+{render('./variant-unstyled')}
+
+### Attributes
+
+The `` element has some unique attributes you can use to control it, such as `multiple` to specify whether multiple options can be selected, and `size` to specify how many options should be shown at once. It also accepts most of the general form input attributes such as `disabled`, `required`, etc.
+
+#### Multiple options
+
+{render('./multiple-options')}
+
+#### `disabled`
+
+{render('./attribute-disabled')}
+
+#### `required`
+
+{render('./attribute-required')}
+
+## Props
+
+### Select
+
+| Name | Type | Default | Description |
+| :--- | :--- | :------ | :---------- |
+| disabled | boolean | | If `true`, the select is disabled and the user cannot interact with it. |
+| error | boolean | | If `true`, the select displays a red border to indicate an error. |
+| variant | string | 'outline' | The variant of the select style to use. One of: 'outline', 'filled', 'unstyled' |
+
+### Option
+
+| Name | Type | Default | Description |
+| :--- | :--- | :------ | :---------- |
+| children | ReactNode | | |
+
+### OptionGroup
+
+| Name | Type | Default | Description |
+| :--- | :--- | :------ | :---------- |
+| children | ReactNode | | |
diff --git a/packages/react-docs/pages/components/select/multiple-options.js b/packages/react-docs/pages/components/select/multiple-options.js
new file mode 100644
index 0000000000..80ac382b15
--- /dev/null
+++ b/packages/react-docs/pages/components/select/multiple-options.js
@@ -0,0 +1,25 @@
+import { Flex, Select } from '@tonic-ui/react';
+import React from 'react';
+
+const FlexOption = ({ style, ...props }) => (
+
+);
+
+const App = () => (
+
+ Option 1
+ Option 2
+ Option 3
+ Option 4
+ Option 5
+ Option 6
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/select/variant-filled.js b/packages/react-docs/pages/components/select/variant-filled.js
new file mode 100644
index 0000000000..0b5ff4422d
--- /dev/null
+++ b/packages/react-docs/pages/components/select/variant-filled.js
@@ -0,0 +1,11 @@
+import { Option, Select } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+ Choose an option
+ Filled
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/select/variant-outline.js b/packages/react-docs/pages/components/select/variant-outline.js
new file mode 100644
index 0000000000..ca16f27583
--- /dev/null
+++ b/packages/react-docs/pages/components/select/variant-outline.js
@@ -0,0 +1,11 @@
+import { Option, Select } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+ Choose an option
+ Outline
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/select/variant-unstyled.js b/packages/react-docs/pages/components/select/variant-unstyled.js
new file mode 100644
index 0000000000..7cfbc5027c
--- /dev/null
+++ b/packages/react-docs/pages/components/select/variant-unstyled.js
@@ -0,0 +1,11 @@
+import { Option, Select } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+ Choose an option
+ Unstyled
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/skeleton.page.mdx b/packages/react-docs/pages/components/skeleton.page.mdx
deleted file mode 100644
index 5321e6ea42..0000000000
--- a/packages/react-docs/pages/components/skeleton.page.mdx
+++ /dev/null
@@ -1,182 +0,0 @@
-# Skeleton
-
-Display a placeholder preview of your content before the data gets loaded to reduce load-time frustration.
-
-## Import
-
-```js
-import { Skeleton } from '@tonic-ui/react';
-```
-
-## Usage
-
-The component is designed to be used when the data for your component might not be immediately available. For instance:
-
-```jsx disabled
-{image
- ?
- :
-}
-```
-
-### Variants
-
-The component supports 3 shape variants:
-* `text` (default) represents a single line of text.
-* `rectangle` and `circle` represent a rectangle and a circle respectively.
-
-```jsx
-
-
-
-
-
-
-```
-
-### Animations
-
-By default, the animation is disabled. You can enable animation by setting the `animation` prop to `wave` or `pulse`.
-
-```jsx noInline
-const FormGroup = (props) => (
-
-);
-
-const useSelection = (defaultValue) => {
- const [value, setValue] = React.useState(defaultValue);
- const changeBy = (value) => () => setValue(value);
- return [value, changeBy];
-};
-
-render(() => {
- const [animation, changeAnimationBy] = useSelection('none');
-
- return (
- <>
-
-
-
- animation
-
-
- *:not(:first-of-type)': {
- marginLeft: -1
- }
- }}
- >
- {['none', 'pulse', 'wave'].map(value => (
-
- {value}
-
- ))}
-
-
-
-
-
-
-
-
- >
- );
-});
-```
-
-### Color
-
-The color of the component can be customized by changing its `backgroundColor` prop. This is especially useful when on a dark background.
-
-```jsx
-
-
-
-```
-
-### More examples
-
-```jsx
-
-
- Modal Title
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- OK
- Cancel
-
-
-
-```
-
-```jsx noInline
-render(() => {
- const [colorMode] = useColorMode();
- const [colorStyle] = useColorStyle({ colorMode });
-
- return (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- );
-});
-```
-
-## Props
-
-### Skeleton
-
-| Name | Type | Default | Description |
-| :--- | :--- | :------ | :---------- |
-| variant | string | 'text' | The type of content that will be rendered. One of: 'text', 'rectangle', 'circle' |
-| animation | string | | The animation effect. One of: 'pulse', 'wave' |
-| width | number \| string | | Width of the skeleton. Useful when the skeleton is inside an inline element with no width of its own. |
-| height | number \| string | | Height of the skeleton. Useful when you don't want to adopt the skeleton to a text element. |
diff --git a/packages/react-docs/pages/components/skeleton/animations.js b/packages/react-docs/pages/components/skeleton/animations.js
new file mode 100644
index 0000000000..e3ebdc1599
--- /dev/null
+++ b/packages/react-docs/pages/components/skeleton/animations.js
@@ -0,0 +1,55 @@
+import { Box, Button, ButtonGroup, Divider, Skeleton, Stack, TextLabel } from '@tonic-ui/react';
+import React from 'react';
+
+const FormGroup = (props) => (
+
+);
+
+const useSelection = (defaultValue) => {
+ const [value, setValue] = React.useState(defaultValue);
+ const changeBy = (value) => () => setValue(value);
+ return [value, changeBy];
+};
+
+const App = () => {
+ const [animation, changeAnimationBy] = useSelection('none');
+
+ return (
+ <>
+
+
+
+ animation
+
+
+ *:not(:first-of-type)': {
+ marginLeft: -1
+ }
+ }}
+ >
+ {['none', 'pulse', 'wave'].map(value => (
+
+ {value}
+
+ ))}
+
+
+
+
+
+
+
+
+ >
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/skeleton/color.js b/packages/react-docs/pages/components/skeleton/color.js
new file mode 100644
index 0000000000..a25b1c3c42
--- /dev/null
+++ b/packages/react-docs/pages/components/skeleton/color.js
@@ -0,0 +1,16 @@
+import { Box, Skeleton } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/skeleton/index.page.mdx b/packages/react-docs/pages/components/skeleton/index.page.mdx
new file mode 100644
index 0000000000..1bd431575e
--- /dev/null
+++ b/packages/react-docs/pages/components/skeleton/index.page.mdx
@@ -0,0 +1,61 @@
+# Skeleton
+
+Display a placeholder preview of your content before the data gets loaded to reduce load-time frustration.
+
+## Import
+
+```js
+import { Skeleton } from '@tonic-ui/react';
+```
+
+## Usage
+
+The component is designed to be used when the data for your component might not be immediately available. For instance:
+
+```jsx disabled
+{image
+ ?
+ :
+}
+```
+
+### Variants
+
+The component supports 3 shape variants:
+* `text` (default) represents a single line of text.
+* `rectangle` and `circle` represent a rectangle and a circle respectively.
+
+{render('./variants')}
+
+### Animations
+
+By default, the animation is disabled. You can enable animation by setting the `animation` prop to `wave` or `pulse`.
+
+{render('./animations')}
+
+### Color
+
+The color of the component can be customized by changing its `backgroundColor` prop. This is especially useful when on a dark background.
+
+{render('./color')}
+
+### Compositions
+
+#### Profile
+
+{render('./profile-skeletons')}
+
+#### Modal
+
+{render('./modal-skeletons')}
+
+## Props
+
+### Skeleton
+
+| Name | Type | Default | Description |
+| :--- | :--- | :------ | :---------- |
+| variant | string | 'text' | The type of content that will be rendered. One of: 'text', 'rectangle', 'circle' |
+| animation | string | | The animation effect. One of: 'pulse', 'wave' |
+| width | number \| string | | Width of the skeleton. Useful when the skeleton is inside an inline element with no width of its own. |
+| height | number \| string | | Height of the skeleton. Useful when you don't want to adopt the skeleton to a text element. |
diff --git a/packages/react-docs/pages/components/skeleton/modal-skeletons.js b/packages/react-docs/pages/components/skeleton/modal-skeletons.js
new file mode 100644
index 0000000000..78cf2c7c65
--- /dev/null
+++ b/packages/react-docs/pages/components/skeleton/modal-skeletons.js
@@ -0,0 +1,44 @@
+import {
+ Button,
+ Grid,
+ ModalBody,
+ ModalContent,
+ ModalHeader,
+ ModalFooter,
+ Skeleton,
+ Stack,
+} from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+ Modal Title
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ OK
+ Cancel
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/skeleton/profile-skeletons.js b/packages/react-docs/pages/components/skeleton/profile-skeletons.js
new file mode 100644
index 0000000000..d93043828a
--- /dev/null
+++ b/packages/react-docs/pages/components/skeleton/profile-skeletons.js
@@ -0,0 +1,27 @@
+import { Box, Divider, Flex, Skeleton, Stack, useColorMode, useColorStyle } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => {
+ const [colorMode] = useColorMode();
+ const [colorStyle] = useColorStyle({ colorMode });
+
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/skeleton/variants.js b/packages/react-docs/pages/components/skeleton/variants.js
new file mode 100644
index 0000000000..e84645ac14
--- /dev/null
+++ b/packages/react-docs/pages/components/skeleton/variants.js
@@ -0,0 +1,13 @@
+import { Skeleton, Stack } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/space.page.mdx b/packages/react-docs/pages/components/space.page.mdx
deleted file mode 100644
index de34a4aecc..0000000000
--- a/packages/react-docs/pages/components/space.page.mdx
+++ /dev/null
@@ -1,49 +0,0 @@
-# Space
-
-Space is [Box](box) with `display="inline-flex"`. You can specify either `width` or `height` to add space between two elements.
-
-## Import
-
-```js
-import { Space } from '@tonic-ui/react';
-```
-
-## Usage
-
-### Horizontal spacing
-
-```jsx
-<>
-
-
-
-
-
-
-
- Settings
-
->
-```
-
-### Vertical spacing
-
-```jsx
-
- Text label
-
-
-
- Help text for the text input
-
-```
-
-## Props
-
-### Space
-
-| Name | Type | Default | Description |
-| :--- | :--- | :------ | :---------- |
-| children | ReactNode | | |
-| height | number \| string | | |
-| width | number \| string | | |
diff --git a/packages/react-docs/pages/components/space/horizontal-spacing.js b/packages/react-docs/pages/components/space/horizontal-spacing.js
new file mode 100644
index 0000000000..9cd9a85d64
--- /dev/null
+++ b/packages/react-docs/pages/components/space/horizontal-spacing.js
@@ -0,0 +1,18 @@
+import { Button, Icon, Space } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+ <>
+
+
+
+
+
+
+
+ Settings
+
+ >
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/space/index.page.mdx b/packages/react-docs/pages/components/space/index.page.mdx
new file mode 100644
index 0000000000..431afb243f
--- /dev/null
+++ b/packages/react-docs/pages/components/space/index.page.mdx
@@ -0,0 +1,29 @@
+# Space
+
+Space is [Box](box) with `display="inline-flex"`. You can specify either `width` or `height` to add space between two elements.
+
+## Import
+
+```js
+import { Space } from '@tonic-ui/react';
+```
+
+## Usage
+
+### Horizontal spacing
+
+{render('./horizontal-spacing')}
+
+### Vertical spacing
+
+{render('./vertical-spacing')}
+
+## Props
+
+### Space
+
+| Name | Type | Default | Description |
+| :--- | :--- | :------ | :---------- |
+| children | ReactNode | | |
+| height | number \| string | | |
+| width | number \| string | | |
diff --git a/packages/react-docs/pages/components/space/vertical-spacing.js b/packages/react-docs/pages/components/space/vertical-spacing.js
new file mode 100644
index 0000000000..a07bbf2359
--- /dev/null
+++ b/packages/react-docs/pages/components/space/vertical-spacing.js
@@ -0,0 +1,14 @@
+import { Flex, Input, Space, Text, TextLabel } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+ Text label
+
+
+
+ Help text for the text input
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/spinner/basic.js b/packages/react-docs/pages/components/spinner/basic.js
new file mode 100644
index 0000000000..d05d4e0edf
--- /dev/null
+++ b/packages/react-docs/pages/components/spinner/basic.js
@@ -0,0 +1,8 @@
+import { Spinner } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+);
+
+export default App;
\ No newline at end of file
diff --git a/packages/react-docs/pages/components/spinner/customization.js b/packages/react-docs/pages/components/spinner/customization.js
new file mode 100644
index 0000000000..db9df8b908
--- /dev/null
+++ b/packages/react-docs/pages/components/spinner/customization.js
@@ -0,0 +1,18 @@
+import { Flex, Spinner, useColorMode, useColorStyle } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => {
+ const [colorMode] = useColorMode();
+ const [colorStyle] = useColorStyle({ colorMode });
+ const trackColor = colorStyle.divider;
+
+ return (
+
+
+
+
+
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/spinner.page.mdx b/packages/react-docs/pages/components/spinner/index.page.mdx
similarity index 70%
rename from packages/react-docs/pages/components/spinner.page.mdx
rename to packages/react-docs/pages/components/spinner/index.page.mdx
index 1d048ca247..7b7564a927 100644
--- a/packages/react-docs/pages/components/spinner.page.mdx
+++ b/packages/react-docs/pages/components/spinner/index.page.mdx
@@ -10,9 +10,7 @@ import { Spinner } from '@tonic-ui/react';
## Usage
-```jsx
-
-```
+{render('./basic')}
### Sizes
@@ -26,15 +24,7 @@ You can use the `size` prop to change the size of the spinner. Each size has a c
| lg | 64 x 64 | 32 | 4 |
| xl | 80 x 80 | 40 | 4 |
-```jsx
-
-
-
-
-
-
-
-```
+{render('./sizes')}
### Customization
@@ -44,21 +34,7 @@ The following props are provided for customization:
* `trackColor` - The track color of the spinner. Set `trackColor` to `none` or `transparent` to remove the track.
* `trackWidth` - The track width of the spinner.
-```jsx
-function Example() {
- const [colorMode] = useColorMode();
- const [colorStyle] = useColorStyle({ colorMode });
- const trackColor = colorStyle.divider;
-
- return (
-
-
-
-
-
- );
-}
-```
+{render('./customization')}
## Props
diff --git a/packages/react-docs/pages/components/spinner/sizes.js b/packages/react-docs/pages/components/spinner/sizes.js
new file mode 100644
index 0000000000..76a8dac27a
--- /dev/null
+++ b/packages/react-docs/pages/components/spinner/sizes.js
@@ -0,0 +1,14 @@
+import { Flex, Spinner } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+
+
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/stack/index.page.mdx b/packages/react-docs/pages/components/stack/index.page.mdx
new file mode 100644
index 0000000000..6704a20aba
--- /dev/null
+++ b/packages/react-docs/pages/components/stack/index.page.mdx
@@ -0,0 +1,29 @@
+# Stack
+
+`Stack` is a layout utility component that makes it easy to stack items together and apply a space between them.
+
+## Import
+
+```js
+import { Stack } from '@tonic-ui/react';
+```
+
+## Usage
+
+Try resizing the browser window width as small as possible to see how `Stack` adapts to the available space.
+
+{render('./usage')}
+
+## Props
+
+### Stack
+
+| Name | Type | Default | Description |
+| :--- | :--- | :------ | :---------- |
+| children | ReactNode | | |
+| direction | string | 'column' | The shorthand of `flexDirection`. |
+| flexDirection | string | 'column' | The direction to stack the items. One of: 'column', 'column-reverse', 'row', 'row-reverse' |
+| flexWrap | string | | Whether to wrap the items. One of: 'nowrap' (default), 'wrap', 'wrap-reverse' |
+| gap | number \| string | | Set the gap between rows and columns. It is useful when `flexWrap` is set to 'wrap' or 'wrap-reverse'. |
+| shouldWrapChildren | boolean | false | If `true`, each child will be wrapped in a `Box` with `display: inline-flex`. |
+| spacing | number \| string | 0 | The space between items based on the direction. |
diff --git a/packages/react-docs/pages/components/stack.page.mdx b/packages/react-docs/pages/components/stack/usage.js
similarity index 70%
rename from packages/react-docs/pages/components/stack.page.mdx
rename to packages/react-docs/pages/components/stack/usage.js
index a77fba1685..5c52fac4eb 100644
--- a/packages/react-docs/pages/components/stack.page.mdx
+++ b/packages/react-docs/pages/components/stack/usage.js
@@ -1,28 +1,33 @@
-# Stack
+/* eslint-disable react/no-unescaped-entities */
+import {
+ Box,
+ Button,
+ ButtonGroup,
+ Checkbox,
+ Divider,
+ Flex,
+ Space,
+ Stack,
+ Text,
+ TextLabel,
+ useColorMode,
+ useColorStyle,
+} from '@tonic-ui/react';
+import { useToggle } from '@tonic-ui/react-hooks';
+import React, { useState } from 'react';
-`Stack` is a layout utility component that makes it easy to stack items together and apply a space between them.
-
-## Import
-
-```js
-import { Stack } from '@tonic-ui/react';
-```
-
-## Usage
-
-Try resizing the browser window width as small as possible to see how `Stack` adapts to the available space.
-
-```jsx noInline
const Item = (props) => {
const [colorMode] = useColorMode();
const [colorStyle] = useColorStyle({ colorMode });
const boxShadow = colorStyle.shadow.thin;
const borderColor = colorMode === 'dark' ? 'gray:70' : 'gray:20';
return (
-
@@ -42,12 +47,12 @@ const Note = (props) => {
};
const useSelection = (defaultValue) => {
- const [value, setValue] = React.useState(defaultValue);
+ const [value, setValue] = useState(defaultValue);
const changeBy = (value) => () => setValue(value);
return [value, changeBy];
};
-function Example() {
+const App = () => {
const [direction, changeDirectionBy] = useSelection('column');
const [flexWrap, changeFlexWrapBy] = useSelection('nowrap');
const [gap, toggleGap] = useToggle(false);
@@ -144,30 +149,14 @@ function Example() {
gap={gap ? '4x' : undefined}
spacing="4x"
>
- - Stacked Item 1
- - Stacked Item 2
- - Stacked Item 3
- - Stacked Item 4
- - Stacked Item 5
- - Stacked Item 6
+ {Array.from({ length: 10 }).map((_, index) => (
+ -
+ Stack Item {index + 1}
+
+ ))}
>
);
-}
-
-render( );
-```
-
-## Props
-
-### Stack
+};
-| Name | Type | Default | Description |
-| :--- | :--- | :------ | :---------- |
-| children | ReactNode | | |
-| direction | string | 'column' | The shorthand of `flexDirection`. |
-| flexDirection | string | 'column' | The direction to stack the items. One of: 'column', 'column-reverse', 'row', 'row-reverse' |
-| flexWrap | string | | Whether to wrap the items. One of: 'nowrap' (default), 'wrap', 'wrap-reverse' |
-| gap | number \| string | | Set the gap between rows and columns. It is useful when `flexWrap` is set to 'wrap' or 'wrap-reverse'. |
-| shouldWrapChildren | boolean | false | If `true`, each child will be wrapped in a `Box` with `display: inline-flex`. |
-| spacing | number \| string | 0 | The space between items based on the direction. |
+export default App;
diff --git a/packages/react-docs/pages/components/svg-icon.page.mdx b/packages/react-docs/pages/components/svg-icon.page.mdx
deleted file mode 100644
index 6854945bf6..0000000000
--- a/packages/react-docs/pages/components/svg-icon.page.mdx
+++ /dev/null
@@ -1,59 +0,0 @@
-# SVGIcon
-
-If you need a custom SVG icon, you can use the `` component to extend the native `` element:
-
-* It comes with built-in accessibility.
-* SVG elements should be scaled for a 24x24px viewport.
-
-## Import
-
-```js
-import { SVGIcon } from '@tonic-ui/react';
-```
-
-## Usage
-
-```jsx
-
-
-
-```
-
-```jsx
-function Example() {
- const CustomIcon = ({ size, ...rest }) => {
- const viewBox = '0 0 16 16';
- return (
-
-
-
- );
- };
-
- return (
-
-
-
-
-
-
-
-
-
-
-
-
- );
-}
-```
-
-## Props
-
-### SVGIcon
-
-| Name | Type | Default | Description |
-| :--- | :--- | :------ | :---------- |
-| size | string | | The size of the icon. |
-| color | string | 'currentColor' | The color of the icon. |
-| focusable | boolean | false | Denotes that the icon is not an interactive element, and only used for presentation. |
-| role | string | 'presentation' | One of: 'presentation', 'img' |
diff --git a/packages/react-docs/pages/components/svg-icon/basic.js b/packages/react-docs/pages/components/svg-icon/basic.js
new file mode 100644
index 0000000000..15339b0073
--- /dev/null
+++ b/packages/react-docs/pages/components/svg-icon/basic.js
@@ -0,0 +1,10 @@
+import { SVGIcon } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+
+);
+
+export default App;
\ No newline at end of file
diff --git a/packages/react-docs/pages/components/svg-icon/custom-icon.js b/packages/react-docs/pages/components/svg-icon/custom-icon.js
new file mode 100644
index 0000000000..a7580083e4
--- /dev/null
+++ b/packages/react-docs/pages/components/svg-icon/custom-icon.js
@@ -0,0 +1,28 @@
+import { Stack, SVGIcon } from '@tonic-ui/react';
+import React from 'react';
+
+const CustomIcon = ({ size, ...rest }) => {
+ const viewBox = '0 0 16 16';
+ return (
+
+
+
+ );
+};
+
+const App = () => (
+
+
+
+
+
+
+
+
+
+
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/svg-icon/index.page.mdx b/packages/react-docs/pages/components/svg-icon/index.page.mdx
new file mode 100644
index 0000000000..bbd88c4f46
--- /dev/null
+++ b/packages/react-docs/pages/components/svg-icon/index.page.mdx
@@ -0,0 +1,31 @@
+# SVGIcon
+
+If you need a custom SVG icon, you can use the `` component to extend the native `` element:
+
+* It comes with built-in accessibility.
+* SVG elements should be scaled for a 24x24px viewport.
+
+## Import
+
+```js
+import { SVGIcon } from '@tonic-ui/react';
+```
+
+## Usage
+
+{render('./basic')}
+
+### Custom icon
+
+{render('./custom-icon')}
+
+## Props
+
+### SVGIcon
+
+| Name | Type | Default | Description |
+| :--- | :--- | :------ | :---------- |
+| size | string | | The size of the icon. |
+| color | string | 'currentColor' | The color of the icon. |
+| focusable | boolean | false | Denotes that the icon is not an interactive element, and only used for presentation. |
+| role | string | 'presentation' | One of: 'presentation', 'img' |
diff --git a/packages/react-docs/pages/components/switch/faq-input-element.js b/packages/react-docs/pages/components/switch/faq-input-ref.js
similarity index 83%
rename from packages/react-docs/pages/components/switch/faq-input-element.js
rename to packages/react-docs/pages/components/switch/faq-input-ref.js
index 540c89d4bc..69c1c3ceb6 100644
--- a/packages/react-docs/pages/components/switch/faq-input-element.js
+++ b/packages/react-docs/pages/components/switch/faq-input-ref.js
@@ -1,16 +1,15 @@
import { Button, Flex, Switch } from '@tonic-ui/react';
-import React, { useRef } from 'react';
+import React, { useCallback, useRef } from 'react';
const App = () => {
const inputRef = useRef();
-
- const handleClick = () => {
+ const handleClick = useCallback(() => {
const inputEl = inputRef?.current;
if (inputEl) {
inputEl.focus();
window.alert('The switch toggle is ' + (inputEl.checked ? 'on' : 'off'));
}
- };
+ }, []);
return (
diff --git a/packages/react-docs/pages/components/switch/index.page.mdx b/packages/react-docs/pages/components/switch/index.page.mdx
index 5e1a6da6c4..e3551c21ed 100644
--- a/packages/react-docs/pages/components/switch/index.page.mdx
+++ b/packages/react-docs/pages/components/switch/index.page.mdx
@@ -59,7 +59,7 @@ Once you have obtained the reference to the input element, you can access its pr
Here's an example of how you can utilize the `inputRef` prop to access the input element and perform actions:
-{render('./faq-input-element')}
+{render('./faq-input-ref')}
## Props
diff --git a/packages/react-docs/pages/components/tag/basic.js b/packages/react-docs/pages/components/tag/basic.js
new file mode 100644
index 0000000000..2f2a19c659
--- /dev/null
+++ b/packages/react-docs/pages/components/tag/basic.js
@@ -0,0 +1,8 @@
+import { Tag } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+ Sample Tag
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/tag/input-tag.js b/packages/react-docs/pages/components/tag/creating-tags.js
similarity index 100%
rename from packages/react-docs/pages/components/tag/input-tag.js
rename to packages/react-docs/pages/components/tag/creating-tags.js
diff --git a/packages/react-docs/pages/components/tag/custom-colors.js b/packages/react-docs/pages/components/tag/custom-colors.js
new file mode 100644
index 0000000000..ec0568cf0c
--- /dev/null
+++ b/packages/react-docs/pages/components/tag/custom-colors.js
@@ -0,0 +1,205 @@
+import { Stack, Tag, useColorMode } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => {
+ const [colorMode] = useColorMode();
+ const solidColors = {
+ dark: [
+ {
+ label: 'Light gray',
+ backgroundColor: 'gray:70',
+ color: 'gray:20'
+ },
+ {
+ label: 'Red',
+ backgroundColor: 'red:80',
+ color: 'red:20'
+ },
+ {
+ label: 'Magenta',
+ backgroundColor: 'magenta:80',
+ color: 'magenta:20'
+ },
+ {
+ label: 'Purple',
+ backgroundColor: 'purple:80',
+ color: 'purple:20'
+ },
+ {
+ label: 'Blue',
+ backgroundColor: 'blue:80',
+ color: 'blue:20'
+ },
+ {
+ label: 'Green',
+ backgroundColor: 'green:70',
+ color: 'green:20'
+ },
+ {
+ label: 'Teal',
+ backgroundColor: 'teal:70',
+ color: 'teal:20'
+ },
+ {
+ label: 'Cyan',
+ backgroundColor: 'cyan:70',
+ color: 'cyan:20'
+ },
+ ],
+ light: [
+ {
+ label: 'Light gray',
+ backgroundColor: 'gray:20',
+ color: 'black:emphasis'
+ },
+ {
+ label: 'Red',
+ backgroundColor: 'red:20',
+ color: 'red:100'
+ },
+ {
+ label: 'Magenta',
+ backgroundColor: 'magenta:20',
+ color: 'magenta:100'
+ },
+ {
+ label: 'Purple',
+ backgroundColor: 'purple:20',
+ color: 'purple:100'
+ },
+ {
+ label: 'Blue',
+ backgroundColor: 'blue:20',
+ color: 'blue:100'
+ },
+ {
+ label: 'Green',
+ backgroundColor: 'green:20',
+ color: 'green:100'
+ },
+ {
+ label: 'Teal',
+ backgroundColor: 'teal:20',
+ color: 'teal:100'
+ },
+ {
+ label: 'Cyan',
+ backgroundColor: 'cyan:20',
+ color: 'cyan:100'
+ },
+ ]
+ }[colorMode];
+ const outlineColors = {
+ dark: [
+ {
+ label: 'Light gray',
+ borderColor: 'gray:40',
+ color: 'gray:40'
+ },
+ {
+ label: 'Red',
+ borderColor: 'red:50',
+ color: 'red:50'
+ },
+ {
+ label: 'Magenta',
+ borderColor: 'magenta:50',
+ color: 'magenta:50'
+ },
+ {
+ label: 'Purple',
+ borderColor: 'purple:50',
+ color: 'purple:50'
+ },
+ {
+ label: 'Blue',
+ borderColor: 'blue:50',
+ color: 'blue:50'
+ },
+ {
+ label: 'Green',
+ borderColor: 'green:50',
+ color: 'green:50'
+ },
+ {
+ label: 'Teal',
+ borderColor: 'teal:50',
+ color: 'teal:50'
+ },
+ {
+ label: 'Cyan',
+ borderColor: 'cyan:50',
+ color: 'cyan:50'
+ },
+ ],
+ light: [
+ {
+ label: 'Light gray',
+ borderColor: 'gray:60',
+ color: 'gray:60'
+ },
+ {
+ label: 'Red',
+ borderColor: 'red:60',
+ color: 'red:60'
+ },
+ {
+ label: 'Magenta',
+ borderColor: 'magenta:60',
+ color: 'magenta:60'
+ },
+ {
+ label: 'Purple',
+ borderColor: 'purple:50',
+ color: 'purple:50'
+ },
+ {
+ label: 'Blue',
+ borderColor: 'blue:60',
+ color: 'blue:60'
+ },
+ {
+ label: 'Green',
+ borderColor: 'green:60',
+ color: 'green:60'
+ },
+ {
+ label: 'Teal',
+ borderColor: 'teal:60',
+ color: 'teal:60'
+ },
+ {
+ label: 'Cyan',
+ borderColor: 'cyan:60',
+ color: 'cyan:60'
+ },
+ ]
+ }[colorMode];
+
+ return (
+
+
+ {solidColors.map(({ backgroundColor, color, label }, index) => (
+ {label}
+ ))}
+
+
+ {solidColors.map(({ backgroundColor, color, label }, index) => (
+ {label}
+ ))}
+
+
+ {outlineColors.map(({ borderColor, color, label }, index) => (
+ {label}
+ ))}
+
+
+ {outlineColors.map(({ borderColor, color, label }, index) => (
+ {label}
+ ))}
+
+
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/tag/index.page.mdx b/packages/react-docs/pages/components/tag/index.page.mdx
index 33984beb13..b0a71c5d0f 100644
--- a/packages/react-docs/pages/components/tag/index.page.mdx
+++ b/packages/react-docs/pages/components/tag/index.page.mdx
@@ -13,273 +13,29 @@ import {
## Usage
-```jsx
-Sample Tag
-```
+{render('./basic')}
### Variants
Use the `variant` prop to change the visual style of the `Tag`. You can set the value to `solid`, `outline`.
-```jsx
-
- Solid Tag
- Outline Tag
-
-```
+{render('./variants')}
### Custom colors
The color of the tag can be changed by passing the `backgroundColor`, `borderColor`, and `color` props. See the [colors](../theme/colors) section to learn more about colors.
-```jsx
-function Example() {
- const [colorMode] = useColorMode();
- const solidColors = {
- dark: [
- {
- label: 'Light gray',
- backgroundColor: 'gray:70',
- color: 'gray:20'
- },
- {
- label: 'Red',
- backgroundColor: 'red:80',
- color: 'red:20'
- },
- {
- label: 'Magenta',
- backgroundColor: 'magenta:80',
- color: 'magenta:20'
- },
- {
- label: 'Purple',
- backgroundColor: 'purple:80',
- color: 'purple:20'
- },
- {
- label: 'Blue',
- backgroundColor: 'blue:80',
- color: 'blue:20'
- },
- {
- label: 'Green',
- backgroundColor: 'green:70',
- color: 'green:20'
- },
- {
- label: 'Teal',
- backgroundColor: 'teal:70',
- color: 'teal:20'
- },
- {
- label: 'Cyan',
- backgroundColor: 'cyan:70',
- color: 'cyan:20'
- },
- ],
- light: [
- {
- label: 'Light gray',
- backgroundColor: 'gray:20',
- color: 'black:emphasis'
- },
- {
- label: 'Red',
- backgroundColor: 'red:20',
- color: 'red:100'
- },
- {
- label: 'Magenta',
- backgroundColor: 'magenta:20',
- color: 'magenta:100'
- },
- {
- label: 'Purple',
- backgroundColor: 'purple:20',
- color: 'purple:100'
- },
- {
- label: 'Blue',
- backgroundColor: 'blue:20',
- color: 'blue:100'
- },
- {
- label: 'Green',
- backgroundColor: 'green:20',
- color: 'green:100'
- },
- {
- label: 'Teal',
- backgroundColor: 'teal:20',
- color: 'teal:100'
- },
- {
- label: 'Cyan',
- backgroundColor: 'cyan:20',
- color: 'cyan:100'
- },
- ]
- }[colorMode];
- const outlineColors = {
- dark: [
- {
- label: 'Light gray',
- borderColor: 'gray:40',
- color: 'gray:40'
- },
- {
- label: 'Red',
- borderColor: 'red:50',
- color: 'red:50'
- },
- {
- label: 'Magenta',
- borderColor: 'magenta:50',
- color: 'magenta:50'
- },
- {
- label: 'Purple',
- borderColor: 'purple:50',
- color: 'purple:50'
- },
- {
- label: 'Blue',
- borderColor: 'blue:50',
- color: 'blue:50'
- },
- {
- label: 'Green',
- borderColor: 'green:50',
- color: 'green:50'
- },
- {
- label: 'Teal',
- borderColor: 'teal:50',
- color: 'teal:50'
- },
- {
- label: 'Cyan',
- borderColor: 'cyan:50',
- color: 'cyan:50'
- },
- ],
- light: [
- {
- label: 'Light gray',
- borderColor: 'gray:60',
- color: 'gray:60'
- },
- {
- label: 'Red',
- borderColor: 'red:60',
- color: 'red:60'
- },
- {
- label: 'Magenta',
- borderColor: 'magenta:60',
- color: 'magenta:60'
- },
- {
- label: 'Purple',
- borderColor: 'purple:50',
- color: 'purple:50'
- },
- {
- label: 'Blue',
- borderColor: 'blue:60',
- color: 'blue:60'
- },
- {
- label: 'Green',
- borderColor: 'green:60',
- color: 'green:60'
- },
- {
- label: 'Teal',
- borderColor: 'teal:60',
- color: 'teal:60'
- },
- {
- label: 'Cyan',
- borderColor: 'cyan:60',
- color: 'cyan:60'
- },
- ]
- }[colorMode];
-
- return (
-
-
- {solidColors.map(({ backgroundColor, color, label }, index) => (
- {label}
- ))}
-
-
- {solidColors.map(({ backgroundColor, color, label }, index) => (
- {label}
- ))}
-
-
- {outlineColors.map(({ borderColor, color, label }, index) => (
- {label}
- ))}
-
-
- {outlineColors.map(({ borderColor, color, label }, index) => (
- {label}
- ))}
-
-
- );
-}
-```
+{render('./custom-colors')}
### Sizes
Use the `size` prop to change the size of the `Tag`. You can set the value to `sm`, `md`, or `lg`.
-```jsx
-
-
- Small
- Medium
- Large
-
-
- Small
- Medium
- Large
-
-
- Small
- Medium
- Large
-
-
- Small
- Medium
- Large
-
-
-```
+{render('./sizes')}
### States
-```jsx
-
-
- Normal
- Disabled
- Error
-
-
- Normal
- Disabled
- Error
-
-
-```
+{render('./states')}
### How to close a tag
@@ -293,18 +49,7 @@ The `isClosable` prop is used to make a tag closable by adding a close button to
```
-```jsx noInline
-render(() => {
- const [isOpen, onClose] = useToggle(true);
- return (
-
-
- This is a tag
-
-
- );
-});
-```
+{render('./using-the-isclosable-prop')}
#### Using the `TagCloseButton` component
@@ -321,19 +66,7 @@ Besides the default functionality of the `TagCloseButton`, you can also pass add
When using the `TagCloseButton` component, be sure to manually adjust its position. In the example above, the close button is positioned with a `2x` (=8px) margin on the left side to ensure sufficient spacing between the tag and the button.
-```jsx noInline
-render(() => {
- const [isOpen, onClose] = useToggle(true);
- return (
-
-
- This is a tag
-
-
-
- );
-});
-```
+{render('./using-the-tagclosebutton-component')}
## Advanced usage
@@ -345,7 +78,7 @@ The tag creation component allows you to easily generate tags for filtering purp
To create a new tag, simply type your desired tag value and press the enter key. This will add the tag to the list. You can also copy and paste a list of tags, separating them with commas (`,`) or semi-colons (`;`), to create multiple tags at once. If you need to remove a tag, just click on the `x` icon or use the backspace key.
-{render('./input-tag')}
+{render('./creating-tags')}
## Props
diff --git a/packages/react-docs/pages/components/tag/sizes.js b/packages/react-docs/pages/components/tag/sizes.js
new file mode 100644
index 0000000000..138051aeb7
--- /dev/null
+++ b/packages/react-docs/pages/components/tag/sizes.js
@@ -0,0 +1,29 @@
+import { Stack, Tag } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+ Small
+ Medium
+ Large
+
+
+ Small
+ Medium
+ Large
+
+
+ Small
+ Medium
+ Large
+
+
+ Small
+ Medium
+ Large
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/tag/states.js b/packages/react-docs/pages/components/tag/states.js
new file mode 100644
index 0000000000..2ff216bed6
--- /dev/null
+++ b/packages/react-docs/pages/components/tag/states.js
@@ -0,0 +1,19 @@
+import { Stack, Tag } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+ Normal
+ Disabled
+ Error
+
+
+ Normal
+ Disabled
+ Error
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/tag/using-the-isclosable-prop.js b/packages/react-docs/pages/components/tag/using-the-isclosable-prop.js
new file mode 100644
index 0000000000..6ce1bc6036
--- /dev/null
+++ b/packages/react-docs/pages/components/tag/using-the-isclosable-prop.js
@@ -0,0 +1,16 @@
+import { Fade, Tag, Text } from '@tonic-ui/react';
+import { useToggle } from '@tonic-ui/react-hooks';
+import React from 'react';
+
+const App = () => {
+ const [isOpen, onClose] = useToggle(true);
+ return (
+
+
+ This is a tag
+
+
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/tag/using-the-tagclosebutton-component.js b/packages/react-docs/pages/components/tag/using-the-tagclosebutton-component.js
new file mode 100644
index 0000000000..cac3f4aa39
--- /dev/null
+++ b/packages/react-docs/pages/components/tag/using-the-tagclosebutton-component.js
@@ -0,0 +1,17 @@
+import { Fade, Tag, TagCloseButton, Text } from '@tonic-ui/react';
+import { useToggle } from '@tonic-ui/react-hooks';
+import React from 'react';
+
+const App = () => {
+ const [isOpen, onClose] = useToggle(true);
+ return (
+
+
+ This is a tag
+
+
+
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/tag/variants.js b/packages/react-docs/pages/components/tag/variants.js
new file mode 100644
index 0000000000..1f255adc70
--- /dev/null
+++ b/packages/react-docs/pages/components/tag/variants.js
@@ -0,0 +1,11 @@
+import { Stack, Tag } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+ Solid Tag
+ Outline Tag
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/text-label/basic.js b/packages/react-docs/pages/components/text-label/basic.js
new file mode 100644
index 0000000000..f4673094e4
--- /dev/null
+++ b/packages/react-docs/pages/components/text-label/basic.js
@@ -0,0 +1,8 @@
+import { TextLabel } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+ Label text:
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/text-label.page.mdx b/packages/react-docs/pages/components/text-label/index.page.mdx
similarity index 91%
rename from packages/react-docs/pages/components/text-label.page.mdx
rename to packages/react-docs/pages/components/text-label/index.page.mdx
index 4c359d1e6e..43a1b9b348 100644
--- a/packages/react-docs/pages/components/text-label.page.mdx
+++ b/packages/react-docs/pages/components/text-label/index.page.mdx
@@ -10,9 +10,7 @@ import { TextLabel } from '@tonic-ui/react';
## Usage
-```jsx
-Label text:
-```
+{render('./basic')}
> The text colors in the dark mode and light mode are `white:secondary` and `black:secondary`, respectively, defined in `theme.colors`.
diff --git a/packages/react-docs/pages/components/text.page.mdx b/packages/react-docs/pages/components/text.page.mdx
deleted file mode 100644
index e40775945e..0000000000
--- a/packages/react-docs/pages/components/text.page.mdx
+++ /dev/null
@@ -1,143 +0,0 @@
-# Text
-
-`Text` is used for rendering text and paragraphs.
-
-## Import
-
-```js
-import { Text } from '@tonic-ui/react';
-```
-
-## Usage
-
-### Sizes
-
-Use the `size` prop to change the corresponding font size and line height. You can set the value to `4xl`, `3xl`, `2xl`, `xl`, `lg`, `md`, `sm`, or `xs`.
-
-```jsx
-
-
- Four Extra Large (4XL)
-
-
- Three Extra Large (3XL)
-
-
- Two Extra Large (2XL)
-
-
- Extra Large (XL)
-
-
- Large (LG)
-
-
- Medium (MD)
-
-
- Small (SM)
-
-
- Extra Small (XS)
-
-
-```
-
-### Heading text
-
-You can format the `Text` component by passing `size` prop and `fontWeight` to display a formatted Heading.
-
-```jsx
-
- Heading 1
- Heading 2
- Heading 3
- Heading 4
- Heading 5
- Heading 6
- Heading 7
-
-```
-
-### Formatting text
-
-You can format the `Text` component by passing `fontSize`, `lineHeight`, or other style props.
-
-```jsx
-function Example() {
- const [colorMode] = useColorMode();
- const bg = colorMode === 'dark' ? 'gray:80' : 'gray:20';
-
- return (
-
-
- This is exactly the same height as the font size
-
-
- A normal line height is about 20% larger than the font size
-
-
- For accessibility concerns, use a minimum value of 1.5 for line-height
for main paragraph content
-
-
- );
-}
-```
-
-### Text truncation
-
-```jsx
-
- Lorem ipsum is placeholder text commonly used in the graphic, print, and publishing industries for previewing layouts and visual mockups. Lorem ipsum is placeholder text commonly used in the graphic, print, and publishing industries for previewing layouts and visual mockups.
-
-```
-
-### The `as` prop
-
-```jsx noInline
-const TextBlock = (props) => {
- const [colorMode] = useColorMode();
- const borderColor = colorMode === 'dark' ? 'gray:70' : 'gray:20';
-
- return (
-
-
-
- );
-};
-
-function Example() {
- return (
-
- Italic
- Underline
- Abbreviation or acronym
- Citation
- Deleted
- Emphasis
- Inserted
- Ctrl + C
- Highlighted
- Strikethrough
- Sample
- Superscript
- Subscript
-
- );
-}
-
-render( );
-```
-
-## Props
-
-### Text
-
-| Name | Type | Default | Description |
-| :--- | :--- | :------ | :---------- |
-| children | ReactNode | | |
-| size | string | | One of: '4xl', '3xl', '2xl', 'xl', 'lg', 'md', 'sm', 'xs' |
diff --git a/packages/react-docs/pages/components/text/formatting-text.js b/packages/react-docs/pages/components/text/formatting-text.js
new file mode 100644
index 0000000000..a0fe91c742
--- /dev/null
+++ b/packages/react-docs/pages/components/text/formatting-text.js
@@ -0,0 +1,23 @@
+import { Stack, Text, useColorMode } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => {
+ const [colorMode] = useColorMode();
+ const bg = colorMode === 'dark' ? 'gray:80' : 'gray:20';
+
+ return (
+
+
+ This is exactly the same height as the font size
+
+
+ A normal line height is about 20% larger than the font size
+
+
+ For accessibility concerns, use a minimum value of 1.5 for line-height
for main paragraph content
+
+
+ );
+};
+
+export default App;
diff --git a/packages/react-docs/pages/components/text/headings.js b/packages/react-docs/pages/components/text/headings.js
new file mode 100644
index 0000000000..d36f929985
--- /dev/null
+++ b/packages/react-docs/pages/components/text/headings.js
@@ -0,0 +1,16 @@
+import { Stack, Text } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+ Heading 1
+ Heading 2
+ Heading 3
+ Heading 4
+ Heading 5
+ Heading 6
+ Heading 7
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/text/index.page.mdx b/packages/react-docs/pages/components/text/index.page.mdx
new file mode 100644
index 0000000000..9793dafce7
--- /dev/null
+++ b/packages/react-docs/pages/components/text/index.page.mdx
@@ -0,0 +1,46 @@
+# Text
+
+`Text` is used for rendering text and paragraphs.
+
+## Import
+
+```js
+import { Text } from '@tonic-ui/react';
+```
+
+## Usage
+
+### Sizes
+
+Use the `size` prop to change the corresponding font size and line height. You can set the value to `4xl`, `3xl`, `2xl`, `xl`, `lg`, `md`, `sm`, or `xs`.
+
+{render('./sizes')}
+
+### Headings
+
+You can format the `Text` component by passing `size` prop and `fontWeight` to display a formatted Heading.
+
+{render('./headings')}
+
+### Formatting text
+
+You can format the `Text` component by passing `fontSize`, `lineHeight`, or other style props.
+
+{render('./formatting-text')}
+
+### Text truncation
+
+{render('./text-truncation')}
+
+### The `as` prop
+
+{render('./the-as-prop')}
+
+## Props
+
+### Text
+
+| Name | Type | Default | Description |
+| :--- | :--- | :------ | :---------- |
+| children | ReactNode | | |
+| size | string | | One of: '4xl', '3xl', '2xl', 'xl', 'lg', 'md', 'sm', 'xs' |
diff --git a/packages/react-docs/pages/components/text/sizes.js b/packages/react-docs/pages/components/text/sizes.js
new file mode 100644
index 0000000000..0593fe0fda
--- /dev/null
+++ b/packages/react-docs/pages/components/text/sizes.js
@@ -0,0 +1,33 @@
+import { Stack, Text } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+
+ Four Extra Large (4XL)
+
+
+ Three Extra Large (3XL)
+
+
+ Two Extra Large (2XL)
+
+
+ Extra Large (XL)
+
+
+ Large (LG)
+
+
+ Medium (MD)
+
+
+ Small (SM)
+
+
+ Extra Small (XS)
+
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/text/text-truncation.js b/packages/react-docs/pages/components/text/text-truncation.js
new file mode 100644
index 0000000000..5abadccf8b
--- /dev/null
+++ b/packages/react-docs/pages/components/text/text-truncation.js
@@ -0,0 +1,14 @@
+import { Text } from '@tonic-ui/react';
+import React from 'react';
+
+const App = () => (
+
+ Lorem ipsum is placeholder text commonly used in the graphic, print, and publishing industries for previewing layouts and visual mockups. Lorem ipsum is placeholder text commonly used in the graphic, print, and publishing industries for previewing layouts and visual mockups.
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/text/the-as-prop.js b/packages/react-docs/pages/components/text/the-as-prop.js
new file mode 100644
index 0000000000..c6ea288362
--- /dev/null
+++ b/packages/react-docs/pages/components/text/the-as-prop.js
@@ -0,0 +1,33 @@
+import { Box, Stack, Text, useColorMode } from '@tonic-ui/react';
+import React from 'react';
+
+const TextBlock = (props) => {
+ const [colorMode] = useColorMode();
+ const borderColor = colorMode === 'dark' ? 'gray:70' : 'gray:20';
+
+ return (
+
+
+
+ );
+};
+
+const App = () => (
+
+ Italic
+ Underline
+ Abbreviation or acronym
+ Citation
+ Deleted
+ Emphasis
+ Inserted
+ Ctrl + C
+ Highlighted
+ Strikethrough
+ Sample
+ Superscript
+ Subscript
+
+);
+
+export default App;
diff --git a/packages/react-docs/pages/components/textarea.page.mdx b/packages/react-docs/pages/components/textarea.page.mdx
deleted file mode 100644
index 90a92350f5..0000000000
--- a/packages/react-docs/pages/components/textarea.page.mdx
+++ /dev/null
@@ -1,199 +0,0 @@
-# Textarea
-
-The `Textarea` component allows you to create a multi-line text input.
-
-## Import
-
-```js
-import { Textarea } from '@tonic-ui/react';
-```
-
-## Usage
-
-```jsx
-<>
- Label:
-
- Help text for the text input
->
-```
-
-### Sizing
-
-* The `rows` and `cols` properties allow you to specify an exact size for the `