diff --git a/packages/grafana-ui/src/components/AutoSaveField/AutoSaveField.mdx b/packages/grafana-ui/src/components/AutoSaveField/AutoSaveField.mdx new file mode 100644 index 00000000000..11b660493e0 --- /dev/null +++ b/packages/grafana-ui/src/components/AutoSaveField/AutoSaveField.mdx @@ -0,0 +1,283 @@ +import { Props, Preview, ArgsTable } from '@storybook/addon-docs/blocks'; +import { AutoSaveField } from './AutoSaveField'; +import { Basic } from './AutoSaveField.story.tsx'; + +# AutoSaveField + +Used for form inputs that should save its content automatically. + +--- + +In this documentation you can find: + +1. [Usage](#usage) +1. [Variants](#variants) +1. [Accessibility](#accessibility) +1. [Content](#content) +1. [Formatting](#formatting) +1. [Behaviours](#behaviours) +1. [Props table](#propstable) +1. [Related](#related) + +
+
+ +## Usage + +
+ +### **Do's** + +- Use in **low-impact** areas within Grafana (examples: team name, display name) +- Include helper text to tell users of the new behaviour for recently modified elements + +
+ +### **Dont's** + +- Do not use if high-impact situations (e.g. saving/changing passwords) +
+
+ +##
Variants + +### 1. Text: + +- The `Input` component allows saving the value of a string. +- This is the main component thought to work as an `AutoSaveField` child. + +```jsx + + {(onChange) => ( + { + onChange(e.currentTarget.value); + //Complete code if needed + }} + /> + )} + +``` + +### 2. TextArea: + +The `TextArea` component allows saving a multi-line text. + +```jsx + + {(onChange) => ( +