Skip to content

Commit c873b33

Browse files
author
Enrique Moreno
committed
Added documentation for paragraph with tokens
1 parent 1e4171e commit c873b33

3 files changed

Lines changed: 93 additions & 69 deletions

File tree

apps/website/screens/components/paragraph/ParagraphPageLayout.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ const ParagraphPageHeading = ({ children }: { children: ReactNode }) => {
1515
<PageHeading>
1616
<DxcFlex direction="column" gap="var(--spacing-gap-xl)">
1717
<ComponentHeading name="Paragraph" />
18-
<DxcParagraph>Paragraph is a block of text.</DxcParagraph>
18+
<DxcParagraph>
19+
A text container component designed for displaying blocks of body content in a consistent, readable format.
20+
</DxcParagraph>
1921
<TabsPageHeading tabs={tabs} />
2022
</DxcFlex>
2123
</PageHeading>
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
import Code from "@/common/Code";
2+
import DocFooter from "@/common/DocFooter";
3+
import QuickNavContainer from "@/common/QuickNavContainer";
4+
import QuickNavContainerLayout from "@/common/QuickNavContainerLayout";
5+
import { DxcFlex, DxcBulletedList, DxcParagraph } from "@dxc-technology/halstack-react";
6+
7+
const sections = [
8+
{
9+
title: "Introduction",
10+
content: (
11+
<>
12+
<DxcParagraph>
13+
The Paragraph component is used to present text content in well-structured, readable blocks across the UI.
14+
</DxcParagraph>
15+
<DxcParagraph>
16+
It is designed to render blocks of text with predefined typography styles, including consistent{" "}
17+
<strong>font-size</strong>,<strong>font-weight</strong>, and <strong>color</strong>. It displays content as
18+
text blocks separated by line breaks and follows the visual language of the design system.
19+
</DxcParagraph>
20+
<DxcParagraph>
21+
However, by default, it <strong>does not add spacing between itself and other elements</strong> — for managing
22+
layout and spacing between Paragraphs or other components, use it in combination with layout components like{" "}
23+
<Code>DxcFlex</Code>.
24+
</DxcParagraph>
25+
</>
26+
),
27+
},
28+
{
29+
title: "Usage",
30+
content: (
31+
<DxcBulletedList>
32+
<DxcBulletedList.Item>
33+
Ideal for body content such as descriptions, instructions, explanations, or legal text.
34+
</DxcBulletedList.Item>
35+
<DxcBulletedList.Item>
36+
Automatically handles line height and text alignment but relies on layout components for external spacing.
37+
</DxcBulletedList.Item>
38+
<DxcBulletedList.Item>
39+
Use Paragraphs to group related sentences and divide longer content into manageable, readable chunks.
40+
</DxcBulletedList.Item>
41+
<DxcBulletedList.Item>
42+
Avoid using Paragraph as a layout or structural element—it is intended strictly for text content.
43+
</DxcBulletedList.Item>
44+
</DxcBulletedList>
45+
),
46+
},
47+
{
48+
title: "Best practices",
49+
content: (
50+
<DxcBulletedList>
51+
<DxcBulletedList.Item>
52+
<strong>Use Paragraph for blocks of text only:</strong> This component is designed to present readable text
53+
content. Avoid using it for non-text elements like buttons or images.
54+
</DxcBulletedList.Item>
55+
<DxcBulletedList.Item>
56+
<strong>Keep paragraphs short and scannable:</strong> Dense blocks of text can be intimidating and hard to
57+
scan. Break content into shorter sections whenever possible. Break content into smaller paragraphs to make it
58+
easier for users to read and for screen readers to navigate.
59+
</DxcBulletedList.Item>
60+
<DxcBulletedList.Item>
61+
<strong>Don't nest paragraphs inside each other:</strong> Paragraph tags (&lt;p&gt;) cannot be nested in valid
62+
HTML. Instead, use separate Paragraph components for each block of text.
63+
</DxcBulletedList.Item>
64+
<DxcBulletedList.Item>
65+
<strong>Use layout components for spacing:</strong> Paragraph does not include spacing between itself and
66+
surrounding elements. Use layout wrappers like DxcFlex to manage spacing between components.
67+
</DxcBulletedList.Item>
68+
<DxcBulletedList.Item>
69+
<strong>Support accessibility:</strong> Clear separation of paragraphs and appropriate structure improves
70+
screen reader support and makes content easier to digest for all users.
71+
</DxcBulletedList.Item>
72+
<DxcBulletedList.Item>
73+
<strong>Ensure visual and semantic clarity:</strong> Paragraphs should support the overall information
74+
hierarchy. Use headings for titles and Paragraphs for descriptive or supporting text.
75+
</DxcBulletedList.Item>
76+
</DxcBulletedList>
77+
),
78+
},
79+
];
80+
81+
const ParagraphOverviewPage = () => (
82+
<DxcFlex direction="column" gap="4rem">
83+
<QuickNavContainerLayout>
84+
<QuickNavContainer sections={sections} startHeadingLevel={2} />
85+
</QuickNavContainerLayout>
86+
<DocFooter githubLink="https://github.com/dxc-technology/halstack-react/blob/master/apps/website/screens/components/paragraph/overview/ParagraphOverviewPage.tsx" />
87+
</DxcFlex>
88+
);
89+
90+
export default ParagraphOverviewPage;

apps/website/screens/components/paragraph/usage/ParagraphUsagePage.tsx

Lines changed: 0 additions & 68 deletions
This file was deleted.

0 commit comments

Comments
 (0)