Socket
Socket
Sign inDemoInstall

@spark-web/heading

Package Overview
Dependencies
67
Maintainers
2
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @spark-web/heading

--- title: Heading storybookPath: typography-heading--default isExperimentalPackage: false ---


Version published
Weekly downloads
716
decreased by-27.38%
Maintainers
2
Install size
10.9 MB
Created
Weekly downloads
 

Readme

Source

title: Heading storybookPath: typography-heading--default isExperimentalPackage: false

Constrained, purposeful heading styles as a component.

Level

Controls the size of the heading and maps to the appropriate heading element (h1, h2, h3 or h4). The rendered element can be overridden with the as prop.

const headingLevels = ['1', '2', '3', '4'];

return (
  <Stack gap="large">
    {headingLevels.map(headingLevel => (
      <Heading key={headingLevel} as="h4" level={headingLevel} tone="neutral">
        Heading level {headingLevel}
      </Heading>
    ))}
  </Stack>
);

Tone

Headings can be either "neutral" or "primary".

<Stack gap="large">
  <Heading level="1" tone="neutral">
    Heading neutral
  </Heading>
  <Heading level="1" tone="primary">
    Heading primary
  </Heading>
</Stack>

Alignment

Text can be aligned with the align prop.

<Stack gap="small" dividers>
  <Heading level="3" align="left">
    Left (default)
  </Heading>
  <Heading level="3" align="center">
    Center
  </Heading>
  <Heading level="3" align="right">
    Right
  </Heading>
</Stack>

Truncation

Truncate text to a single line using the truncate prop. Useful for displaying user-generated content that may not fit within your layout.

<Stack gap="large" style={{ width: 200 }}>
  <Heading level="3" truncate>
    The quick brown fox jumps over the lazy
  </Heading>
</Stack>

Contrast

To ensure headings have sufficient contrast, when on a dark background the foreground colour is inverted.

<Box background="neutral" padding="large" borderRadius="small">
  <Heading level="3">This Heading is inverted to improve contrast.</Heading>
</Box>

Props

Extra props are passed into the underlying Box component.

FAQs

Last updated on 23 Jan 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc