diff --git a/packages/components/src/autocomplete/README.md b/packages/components/src/autocomplete/README.md
index 102f88d4532501..fe7a467dfd30ba 100644
--- a/packages/components/src/autocomplete/README.md
+++ b/packages/components/src/autocomplete/README.md
@@ -1,5 +1,4 @@
-Autocomplete
-============
+# Autocomplete
This component is used to provide autocompletion support for a child input component.
@@ -105,33 +104,59 @@ Whether to apply debouncing for the autocompleter. Set to true to enable debounc
- Type: `Boolean`
- Required: No
-### Examples
+## Usage
The following is a contrived completer for fresh fruit.
```jsx
-const fruitCompleter = {
- name: 'fruit',
- // The prefix that triggers this completer
- triggerPrefix: '~',
- // The option data
- options: [
- { visual: '🍎', name: 'Apple' },
- { visual: '🍊', name: 'Orange' },
- { visual: '🍇', name: 'Grapes' },
- ],
- // Returns a label for an option like "🍊 Orange"
- getOptionLabel: option => [
- { option.visual },
- option.name
- ],
- // Declares that options should be matched by their name
- getOptionKeywords: option => [ option.name ],
- // Declares that the Grapes option is disabled
- isOptionDisabled: option => option.name === 'Grapes',
- // Declares completions should be inserted as abbreviations
- getOptionCompletion: option => (
- { option.visual }
- ),
+import { Autocomplete } from '@wordpress/components';
+
+function FreshFruitAutocomplete() {
+ const autocompleters = [
+ {
+ name: 'fruit',
+ // The prefix that triggers this completer
+ triggerPrefix: '~',
+ // The option data
+ options: [
+ { visual: '🍎', name: 'Apple', id: 1 },
+ { visual: '🍊', name: 'Orange', id: 2 },
+ { visual: '🍇', name: 'Grapes', id: 3 },
+ ],
+ // Returns a label for an option like "🍊 Orange"
+ getOptionLabel: option => (
+
+ { option.visual }{ option.name }
+
+ ),
+ // Declares that options should be matched by their name
+ getOptionKeywords: option => [ option.name ],
+ // Declares that the Grapes option is disabled
+ isOptionDisabled: option => option.name === 'Grapes',
+ // Declares completions should be inserted as abbreviations
+ getOptionCompletion: option => (
+ { option.visual }
+ ),
+ }
+ ];
+
+ return (
+
+
+ { ( { isExpanded, listBoxId, activeId } ) => (
+
+
+ ) }
+
+
Type ~ for triggering the autocomplete.
+
+ );
};
```
diff --git a/packages/components/src/base-control/README.md b/packages/components/src/base-control/README.md
index ac2dc6249714a1..1dd091908176d1 100644
--- a/packages/components/src/base-control/README.md
+++ b/packages/components/src/base-control/README.md
@@ -1,5 +1,4 @@
-BaseControl
-=======
+# BaseControl
BaseControl component is used to generate labels and help text for components handling user inputs.
@@ -8,17 +7,21 @@ BaseControl component is used to generate labels and help text for components ha
Render a BaseControl for a textarea input:
```jsx
-
-
-
+import { BaseControl } from '@wordpress/components';
+
+function MyBaseControl() {
+ return (
+
+
+
+ );
+}
```
## Props
diff --git a/packages/components/src/button-group/README.md b/packages/components/src/button-group/README.md
new file mode 100644
index 00000000000000..34a8965687cd65
--- /dev/null
+++ b/packages/components/src/button-group/README.md
@@ -0,0 +1,16 @@
+# ButtonGroup
+
+## Usage
+
+```jsx
+import { Button, ButtonGroup } from '@wordpress/components';
+
+function MyButtonGroup() {
+ return (
+
+
+
+
+ );
+}
+```
diff --git a/packages/components/src/button/README.md b/packages/components/src/button/README.md
index 1bd9d997f481fb..d88151ad2b8400 100644
--- a/packages/components/src/button/README.md
+++ b/packages/components/src/button/README.md
@@ -9,12 +9,9 @@ The presence of a `href` prop determines whether an `anchor` element is rendered
Renders a button with default style.
```jsx
-/**
- * WordPress dependencies
- */
import { Button } from "@wordpress/components";
-export default function ClickMeButton() {
+function MyButton() {
return (