From 9359603a0a08b543dae7db8ca86f7c8b82b715e8 Mon Sep 17 00:00:00 2001 From: Benjamin Canac Date: Fri, 18 Oct 2024 15:19:10 +0200 Subject: [PATCH] docs(input): add examples --- .../input/InputButtonGroupExample.vue | 26 ++++++ .../input/InputCharacterLimitExample.vue | 24 +++++ .../input/InputClearButtonExample.vue | 22 +++++ .../input/InputFloatingLabelExample.vue | 11 +++ .../examples/input/InputFormFieldExample.vue | 9 ++ .../InputPasswordStrengthIndicatorExample.vue | 93 +++++++++++++++++++ .../input/InputPasswordToggleExample.vue | 26 ++++++ docs/content/3.components/command-palette.md | 6 +- docs/content/3.components/input.md | 79 +++++++++++++++- 9 files changed, 292 insertions(+), 4 deletions(-) create mode 100644 docs/app/components/content/examples/input/InputButtonGroupExample.vue create mode 100644 docs/app/components/content/examples/input/InputCharacterLimitExample.vue create mode 100644 docs/app/components/content/examples/input/InputClearButtonExample.vue create mode 100644 docs/app/components/content/examples/input/InputFloatingLabelExample.vue create mode 100644 docs/app/components/content/examples/input/InputFormFieldExample.vue create mode 100644 docs/app/components/content/examples/input/InputPasswordStrengthIndicatorExample.vue create mode 100644 docs/app/components/content/examples/input/InputPasswordToggleExample.vue diff --git a/docs/app/components/content/examples/input/InputButtonGroupExample.vue b/docs/app/components/content/examples/input/InputButtonGroupExample.vue new file mode 100644 index 00000000..b9d914e7 --- /dev/null +++ b/docs/app/components/content/examples/input/InputButtonGroupExample.vue @@ -0,0 +1,26 @@ + + + diff --git a/docs/app/components/content/examples/input/InputCharacterLimitExample.vue b/docs/app/components/content/examples/input/InputCharacterLimitExample.vue new file mode 100644 index 00000000..19bb36a8 --- /dev/null +++ b/docs/app/components/content/examples/input/InputCharacterLimitExample.vue @@ -0,0 +1,24 @@ + + + diff --git a/docs/app/components/content/examples/input/InputClearButtonExample.vue b/docs/app/components/content/examples/input/InputClearButtonExample.vue new file mode 100644 index 00000000..f3e48dcb --- /dev/null +++ b/docs/app/components/content/examples/input/InputClearButtonExample.vue @@ -0,0 +1,22 @@ + + + diff --git a/docs/app/components/content/examples/input/InputFloatingLabelExample.vue b/docs/app/components/content/examples/input/InputFloatingLabelExample.vue new file mode 100644 index 00000000..76af50f6 --- /dev/null +++ b/docs/app/components/content/examples/input/InputFloatingLabelExample.vue @@ -0,0 +1,11 @@ + + + diff --git a/docs/app/components/content/examples/input/InputFormFieldExample.vue b/docs/app/components/content/examples/input/InputFormFieldExample.vue new file mode 100644 index 00000000..04722308 --- /dev/null +++ b/docs/app/components/content/examples/input/InputFormFieldExample.vue @@ -0,0 +1,9 @@ + + + diff --git a/docs/app/components/content/examples/input/InputPasswordStrengthIndicatorExample.vue b/docs/app/components/content/examples/input/InputPasswordStrengthIndicatorExample.vue new file mode 100644 index 00000000..15cf04c3 --- /dev/null +++ b/docs/app/components/content/examples/input/InputPasswordStrengthIndicatorExample.vue @@ -0,0 +1,93 @@ + + + diff --git a/docs/app/components/content/examples/input/InputPasswordToggleExample.vue b/docs/app/components/content/examples/input/InputPasswordToggleExample.vue new file mode 100644 index 00000000..c717778a --- /dev/null +++ b/docs/app/components/content/examples/input/InputPasswordToggleExample.vue @@ -0,0 +1,26 @@ + + + diff --git a/docs/content/3.components/command-palette.md b/docs/content/3.components/command-palette.md index 3c1ad344..50c6e3c5 100644 --- a/docs/content/3.components/command-palette.md +++ b/docs/content/3.components/command-palette.md @@ -514,7 +514,7 @@ class: '!p-0' --- :: -### Within a popover +### Within a Popover You can use the CommandPalette component inside a [Popover](/components/popover)'s content. @@ -525,7 +525,7 @@ name: 'popover-command-palette-example' --- :: -### Within a modal +### Within a Modal You can use the CommandPalette component inside a [Modal](/components/modal)'s content. @@ -536,7 +536,7 @@ name: 'modal-command-palette-example' --- :: -### Within a drawer +### Within a Drawer You can use the CommandPalette component inside a [Drawer](/components/drawer)'s content. diff --git a/docs/content/3.components/input.md b/docs/content/3.components/input.md index 9b86c56e..230139de 100644 --- a/docs/content/3.components/input.md +++ b/docs/content/3.components/input.md @@ -37,7 +37,7 @@ items: - search - file props: - type: 'number' + type: 'file' --- :: @@ -202,6 +202,83 @@ props: --- :: +## Examples + +### With clear button + +You can put a [Button](/components/button) inside the `#trailing` slot to clear the Input. + +::component-example +--- +name: 'input-clear-button-example' +--- +:: + +### With password toggle + +You can put a [Button](/components/button) inside the `#trailing` slot to toggle the password visibility. + +::component-example +--- +name: 'input-password-toggle-example' +--- +:: + +### With password strength indicator + +You can use the [Progress](/components/progress) component to display the password strength indicator. + +::component-example +--- +collapse: true +name: 'input-password-strength-indicator-example' +--- +:: + +### With character limit + +You can use the `#trailing` slot to add a character limit to the Input. + +::component-example +--- +name: 'input-character-limit-example' +--- +:: + +### With floating label + +You can use the `#default` slot to add a floating label to the Input. + +::component-example +--- +name: 'input-floating-label-example' +--- +:: + +### Within a FormField + +You can use the Input within a [FormField](/components/form-field) component to display a label, help text, required indicator, etc. + +::component-example +--- +name: 'input-form-field-example' +--- +:: + +::tip{to="/components/form"} +It also provides validation and error handling when used within a [Form](/components/form) component. +:: + +### Within a ButtonGroup + +You can use the Input within a [ButtonGroup](/components/button-group) component to group multiple elements together. + +::component-example +--- +name: 'input-button-group-example' +--- +:: + ## API ### Props