Skip to content

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Text Component

This package contains a single module that exports a Text component. The Text component is a versatile text rendering component that can render various HTML heading tags (<h1> to <h6>) or a paragraph <p>.

Installation

To install the package, use pnpm:

pnpm dlx jsr add @witt/text

Usage

Here is an example of how to use the Text component in your project:

import React from "react"
import Text from "@witt/text"

function App() {
  return (
    <div>
      <Text tag="h1" className="heading">
        This is a heading
      </Text>
      <Text className="paragraph">This is a paragraph</Text>
    </div>
  )
}

export default App

Props

The Text component accepts the following props:

  1. tag (optional): Specifies the HTML tag to render. It can be one of "h1", "h2", "h3", "h4", "h5", "h6", or "p". The default value is "p".
  2. className: A string of CSS class names to apply to the element.
  3. children: The content to be rendered inside the element.
  4. props: Any other standard HTML attributes for the rendered HTML element.
import React from "react"
import Text from "@witt/text"

function Example() {
  return (
    <div>
      <Text tag="h2" className="title">
        Example Heading
      </Text>
      <Text className="body-text">
        This is an example paragraph demonstrating the usage of the Text
        component.
      </Text>
    </div>
  )
}

export default Example

License

This project is licensed under the MIT License.

About

The Text component is a flexible React component that renders HTML headings (<h1> to <h6>) or a paragraph (<p>). Customize it with any tag, CSS classes, and content, making it perfect for consistent and customizable text in your React apps.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages