mi6 / mi6/ic-ui-kit

[ic-typography]: Introduce an optional prop that renders a HTML tag inside `IcTypography`

Open
#3,754 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

a11y component: ic-typography
Dominant language
TypeScript
Stars
53
Forks
63
Avg merge
2d 4h
Merged PRs (30d)
15

Description

### 💬 Description
Introduce an optional prop that renders a HTML heading tag (`

` to `

`), `

` or `` tag inside the `` component.

### 💰 User value
A recent field study showed that there's a bit confusion on whether the `` component renders a heading tag based on the value of the `variant` prop. Introducing an additional prop could provide clarity. It will also help us align better with other design systems that users are migrating from, for example:

- [Chakra UI's `as` prop for their `Heading` component](https://chakra-ui.com/docs/components/heading#as-another-element)
- [Porshe's `tag` prop for their `Heading` component](https://designsystem.porsche.com/v3/components/heading/examples/#semantics)
- [Adobe's `level` prop for their `Heading` component](https://react-spectrum.adobe.com/react-spectrum/Heading.html)
- [Primer's (GitHub) `as` prop for their `Heading` component](https://primer.style/product/components/heading/#default)
- [MUI's `component` prop for their `Typography` component](https://primer.style/product/components/heading/#default)
- [Mantine's `order` prop for their `Title` component](https://mantine.dev/core/title/#usage)

I believe the above examples demonstrate that there's precedent for this new prop on `IcTypography`

### 📚 User Stories
*As an* ICDS user:
*I need* a clear method of displaying my headings
*So that* I can maintain an accessible product

### 📝 Acceptance Criteria
*Given* I'm using semantic HTML to maintain hierarchical order
*When* I am using the `IcTypography`
*Then* I can set the semantic HTML tag applied within `IcTypography`

### 🚨 Urgency (low, medium or high)
Low

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the IcTypography component entry point and review how its variant currently affects rendered markup. Trace the component's existing tests or usage examples, then verify that the optional prop supports h1 through h6, p, and span while preserving semantic heading order.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
accessibility, frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.