Skip to content

Commit

Permalink
styles: enhance component prop JSDoc to add information about valid u…
Browse files Browse the repository at this point in the history
…sage
  • Loading branch information
mgadewoll committed Sep 4, 2024
1 parent 8b61b90 commit 8a0af41
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/eui/src/components/text/text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ export type TextSize = (typeof TEXT_SIZES)[number];
export type EuiTextProps = CommonProps &
Omit<HTMLAttributes<HTMLDivElement>, 'color'> & {
/**
* The HTML element/tag to render
* The HTML element/tag to render.
* Use with care when nesting multiple components to ensure valid html.
* Block elements can't be nested inside inline elements: `<p>` and `<div>` are not valid inside `<span>`.
* Additionally `<div>` is not valid to use inside `<p>`.
*/
component?: 'div' | 'span' | 'p';
textAlign?: TextAlignment;
Expand Down
3 changes: 3 additions & 0 deletions packages/eui/src/components/text/text_align.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ export type EuiTextAlignProps = CommonProps &
HTMLAttributes<HTMLDivElement> & {
/**
* The HTML element/tag to render
* Use with care when nesting multiple components to ensure valid html.
* Block elements can't be nested inside inline elements. (<p> and <div> are not valid inside <span>)
* Additionally <div> is not valid to use inside <p>.
*/
component?: 'div' | 'span' | 'p';
textAlign?: TextAlignment;
Expand Down
3 changes: 3 additions & 0 deletions packages/eui/src/components/text/text_color.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ export type EuiTextColorProps = CommonProps &
color?: TextColor | CSSProperties['color'];
/**
* The HTML element/tag to render
* Use with care when nesting multiple components to ensure valid html.
* Block elements can't be nested inside inline elements. (<p> and <div> are not valid inside <span>)
* Additionally <div> is not valid to use inside <p>.
*/
component?: 'div' | 'span' | 'p';
/**
Expand Down

0 comments on commit 8a0af41

Please sign in to comment.