Skip to content

Commit 2aa9638

Browse files
author
shleewhite
committed
fix: add more information
1 parent fe74f62 commit 2aa9638

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

website/docs/getting-started/for-engineers.md

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,25 +78,45 @@ Our component library assumes that a box-sizing reset is applied globally in you
7878

7979
### Single file components
8080

81-
If you are are using single file components (i.e., `.gts` or `.gjs` files), the components need to be individually imported into the file for them to render. All components can be imported from the `@hashicorp/design-system-components/components` path.
81+
If you are are using single file components (ie., `.gts` or `.gjs` files), the components need to be individually imported into the file for them to render. All components can be imported from the `@hashicorp/design-system-components/components` path. To use a component's signature, you must import it from the definition file.
8282

8383
```typescript
84-
import type { TemplateOnlyComponent } from '@ember/component/template-only';
84+
import type { TOC } from '@ember/component/template-only';
8585
import {
8686
HdsButton,
8787
HdsFormTextInputField
8888
} from '@hashicorp/design-system-components/components';
8989

90-
const MyComponent: TemplateOnlyComponent = <template>
91-
<HdsFormTextInputField as |F|>
90+
import type {
91+
HdsFormTextInputFieldSignature
92+
} from '@hashicorp/design-system-components/components/hds/form/text-input/field';
93+
94+
interface MyComponentSignature {
95+
Args: {};
96+
Element: HdsFormTextInputFieldSignature;
97+
}
98+
99+
const MyComponent: TOC<MyComponentSignature> = <template>
100+
<HdsFormTextInputField ...attributes as |F|>
92101
<F.Label>Name</F.Label>
93102
</HdsFormTextInputField>
94-
<HdsButton @text="Save">
103+
<HdsButton type="submit" @text="Save">
95104
</template>;
96105

97106
export default MyComponent;
98107
```
99108

109+
In the rare cases where you need to use an HDS modifier, they are only exported from their definition file
110+
111+
```typescript
112+
import hdsTooltip from '@hashicorp/design-system-components/modifiers/hds-tooltip';
113+
import hdsCodeEditor from '@hashicorp/design-system-components/modifiers/hds-code-editor';
114+
```
115+
116+
For more information on single file components, see the Ember docs:
117+
* [Intro to components](https://guides.emberjs.com/release/components/introducing-components/)
118+
* [Glimmer components](https://guides.emberjs.com/release/typescript/core-concepts/invokables/#toc_glimmer-components)
119+
100120
## Icons
101121

102122
There are two ways to use icons in your codebase. We provide icons:

0 commit comments

Comments
 (0)