Basic
Hello world
<H1>Hello world</H1>
Alongside paragraphs
Hello world
Illo quia quam perferendis ut consectetur rerum dolores dolores. Reiciendis est beatae magnam ut amet quis sequi. Eaque consequatur consectetur non amet nostrum quo animi.
Quod enim vitae et. Impedit ut maxime fugit excepturi harum qui.Praesentium pariatur nisi ut rerum et dolores sed.
<div>
<H1>Hello world</H1>
<Text>
<p>
Illo quia quam perferendis ut consectetur rerum dolores dolores.
Reiciendis est beatae magnam ut amet quis sequi. Eaque consequatur
consectetur non amet nostrum quo animi.
</p>
<p>
Quod enim vitae et. Impedit ut maxime fugit excepturi harum
qui.Praesentium pariatur nisi ut rerum et dolores sed.
</p>
</Text>
</div>
Without default margins
By default, there is a top and bottom margin applied to the heading. This is helpful a) by providing a sensible default and b) by helping you maintain consistent spacing throughout your app. However, you can override these default margins if you'd like as shown below.
The example below uses Tailwind's imporant modifier to make sure that the custom margins take precedence over the original margins. You may need or want to take a different approach.
Hello world
<H1 class="!my-4">Hello world</H1>
Props
children
*Required
true
Type
ComponentChild
Default
none
...rest
Required
false
Type
ComponentProps<"h1">
Default
none
Notes
See the docs for rest parameters. For
H1
, you could pass anything you normally would pass to <h1>
because the return value looks something like this:<h1
class={className}
{...restWithoutClass}
>
{children}
</h1>