Display

A title designed for prominent display at large sizes, specifically for use in the hero section of a webpage.

A Display

Installation

Copy-Paste the component code in a .tsx file.

import React from "react"
import {
    display,
    type DisplayProps as DisplayVariants,
    type TextAlignProp,
    type TextWeightProp
} from "@tailus/themer"

type DisplaySize = DisplayVariants["size"]
type DisplaySizeProp = DisplaySize |  {
    initial?: DisplaySize,
    sm?: DisplaySize,
    md?: DisplaySize,
    lg?: DisplaySize,
    xl?: DisplaySize,
    xxl?: DisplaySize,
}

export interface DisplayProps extends React.HTMLAttributes<HTMLHeadingElement> {
    as?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "div" | "span",
    children: React.ReactNode,
    className?: string,
    size?: DisplaySizeProp;
    align?: TextAlignProp;
    weight? : TextWeightProp
}

export const Display: React.FC<DisplayProps> = ({
    size,
    as="h1",
    weight,
    align,
    children,
    className,
    ...props
}) => {
    const DisplayElement = as
    return (
        <DisplayElement className={display({
            size,
            weight,
            align,
            className
        })} {...props}>
            {children}
        </DisplayElement>
    )
}

Display.displayName = "Display"

Usage

Import the <Display/> in your hero section component and start building.

import { Display } from "@tailus-ui/typography";
const HeroSection = () => (
    <Display>A Display</Display>
)

Reference

The Display component has the following props

Prop
Type
Default
as
enum
h1
size ~
enum
4xl
align ~
enum
left
weight ~
enum
className
string
children
ReactNode