Skip to content

Commit

Permalink
chore: updating docs
Browse files Browse the repository at this point in the history
  • Loading branch information
georgewrmarshall committed Nov 23, 2024
1 parent 7716803 commit a39a11e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 27 deletions.
24 changes: 11 additions & 13 deletions packages/design-system-react/src/components/text/README.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -220,23 +220,21 @@ Examples:

Note: When using `asChild` with form elements like inputs, the Text component's styles will be applied while maintaining the element's native functionality. You can also add additional className props to further customize the styling of the rendered element.

### Ref Forwarding
### Class Name

The Text component supports ref forwarding, allowing you to access the underlying DOM element:
Adds an additional class to the `Text` component.

```jsx
const ref = useRef(null);
<Text ref={ref}>This text's DOM element can be accessed via ref</Text>;
```
### Style

When used with `asChild`, the ref will be forwarded to the child component:
The `style` prop should primarily be used for dynamic inline styles that cannot be achieved with className alone. For static styles, prefer using className with Tailwind classes.

```jsx
const ref = useRef(null);
<Text asChild ref={ref}>
<button>The ref will point to this button element</button>
</Text>;
```
### Children

The text content of the `Text` component.

### Component API

<Controls of={TextStories.Default} />

### References

Expand Down
14 changes: 0 additions & 14 deletions packages/design-system-react/src/components/text/Text.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,17 +181,3 @@ export const AsChild: Story = {
</div>
),
};
AsChild.storyName = 'AsChild';

export const Strong: Story = {
render: () => (
<div className="space-y-4">
<Text asChild>
<strong>Text as strong tag</strong>
</Text>
<Text>
This is a <strong>strong tag</strong> as a child inside of Text
</Text>
</div>
),
};

0 comments on commit a39a11e

Please sign in to comment.