From eb9ce6a0ddb7d73e3d3accee000ac71c20b96d1b Mon Sep 17 00:00:00 2001 From: "Haytham A. Salama" Date: Thu, 5 Oct 2023 15:43:58 +0300 Subject: [PATCH] feat(Divider): new component (#757) Co-authored-by: Benjamin Canac --- .../examples/DividerExampleDefaultSlot.vue | 5 + .../examples/DividerExampleOrientation.vue | 47 +++++ docs/content/7.layout/4.divider.md | 184 ++++++++++++++++++ docs/pages/[...slug].vue | 4 +- src/runtime/components/layout/Divider.vue | 116 +++++++++++ src/runtime/ui.config.ts | 30 +++ 6 files changed, 384 insertions(+), 2 deletions(-) create mode 100644 docs/components/content/examples/DividerExampleDefaultSlot.vue create mode 100644 docs/components/content/examples/DividerExampleOrientation.vue create mode 100644 docs/content/7.layout/4.divider.md create mode 100644 src/runtime/components/layout/Divider.vue diff --git a/docs/components/content/examples/DividerExampleDefaultSlot.vue b/docs/components/content/examples/DividerExampleDefaultSlot.vue new file mode 100644 index 00000000..923ec04c --- /dev/null +++ b/docs/components/content/examples/DividerExampleDefaultSlot.vue @@ -0,0 +1,5 @@ + diff --git a/docs/components/content/examples/DividerExampleOrientation.vue b/docs/components/content/examples/DividerExampleOrientation.vue new file mode 100644 index 00000000..16cfc585 --- /dev/null +++ b/docs/components/content/examples/DividerExampleOrientation.vue @@ -0,0 +1,47 @@ + + + diff --git a/docs/content/7.layout/4.divider.md b/docs/content/7.layout/4.divider.md new file mode 100644 index 00000000..8b39b450 --- /dev/null +++ b/docs/content/7.layout/4.divider.md @@ -0,0 +1,184 @@ +--- +description: Display a separator between content. +links: + - label: GitHub + icon: i-simple-icons-github + to: https://github.com/nuxt/ui/blob/dev/src/runtime/components/layout/Divider.vue +navigation: + badge: New +--- + +## Usage + +You can pass `label`, `icon` or `avatar` to the divider component. + +### Label + +::component-card +--- +props: + label: OR +--- +:: + +### Icon + +Use any icon from [Iconify](https://icones.js.org) by setting the `icon` prop by using this pattern: `i-{collection_name}-{icon_name}`. + +::component-card +--- +props: + icon: 'i-simple-icons-github' +excludedProps: + - icon +--- +:: + +### Avatar + +Use the [avatar](/elements/avatar) prop as an `object` and configure it with any of its props. + +::component-card +--- +props: + avatar: + src: https://avatars.githubusercontent.com/u/739984?v=4 +excludedProps: + - avatar +--- +:: + +### Orientation + +You can change the orientation of the divider by setting the `orientation` prop to `horizontal` or `vertical`. Defaults to `horizontal`. + +::component-example +#default +:divider-example-orientation + +#code +```vue + + + +``` +:: + +### Type + +You can change the type of the divider by setting the `type` prop to `solid`, `dotted` or `dashed`. Defaults to `solid`. + +::component-card{class="w-full"} +--- +props: + label: Nuxt UI + type: dashed +excludedProps: + - label +--- +:: + +### Size + +You can change the size of the divider by using the `ui` prop + +::component-card +--- +props: + label: Nuxt UI + ui: + border: + size: + horizontal: border-t-2 +excludedProps: + - label + - ui +--- +:: + +### Color + +You can change the color of the content by using the `ui` prop + +::component-card +--- +props: + label: Nuxt UI + ui: + label: text-primary-500 dark:text-primary-400 +excludedProps: + - label + - ui +--- +:: + +## Slots + +### `default` + +Use the `default` slot to add content to the divider. + +::component-example +#default +:divider-example-default-slot +#code +```vue + +``` +:: + +## Props + +:component-props + +## Preset + +:component-preset diff --git a/docs/pages/[...slug].vue b/docs/pages/[...slug].vue index 98f35682..fd0d002f 100644 --- a/docs/pages/[...slug].vue +++ b/docs/pages/[...slug].vue @@ -5,7 +5,7 @@ - +
@@ -14,7 +14,7 @@