diff --git a/docs-app/package.json b/docs-app/package.json index d3be8d9b7..50936a0f0 100644 --- a/docs-app/package.json +++ b/docs-app/package.json @@ -31,6 +31,7 @@ "@docfy/core": "^0.5.0", "@docfy/ember": "^0.5.0", "@ember/optional-features": "^2.0.0", + "@ember/string": "^3.0.1", "@ember/test-helpers": "^2.8.1", "@embroider/compat": "^2.0.0", "@embroider/core": "^2.0.0", diff --git a/docs/components/field/demo/base-demo.md b/docs/components/field/demo/base-demo.md new file mode 100644 index 000000000..73176b6b1 --- /dev/null +++ b/docs/components/field/demo/base-demo.md @@ -0,0 +1,22 @@ +```hbs template + + Label + Extra information about the field + + + + Error message + +``` + +```js component +import Component from '@glimmer/component'; + +export default class extends Component {} +``` diff --git a/docs/components/field/index.md b/docs/components/field/index.md new file mode 100644 index 000000000..687757454 --- /dev/null +++ b/docs/components/field/index.md @@ -0,0 +1,74 @@ +# Field + +Field is a component to aid in creating form components. It provides a label, hint sections for things like help text, a control block, and an error section for rendering errors. It allows users to provide custom controls with a consistent form-element shell and is not opinionated on what underlying control element is used. + +## Yielded Items + +- `id`: A unique ID to provide to the control element `id` attribute and the Label component `for` attribute. +- `hintId`: A unique ID to provide to the control element `aria-describedby` attribute and the Hint component `id` attribute. +- `errorId`: A unique ID to provide to the control element `aria-describedby` or `aria-errormessage` attribute and the Error component `id` attribute. +- `Label`: Renders a `