🎨
Valence
🎨
Valence
  • Overview
    • 👋Welcome to Valence
    • 🏄‍♂️Getting started
  • Core Concepts
    • Responsiveness
    • Color
      • List of colors
      • Color types
    • Polymorphism
  • Valence Core
    • 🏃‍♂️Fundamentals
      • 🎬The ValenceProvider
      • ✍️Using custom fonts
    • 🧱Components
      • 🔘Buttons
        • Button with icon
        • Grid Button
        • Text button
        • Icon button
        • Multi-part button
        • Unstyled button
        • Primitive button
      • ⌨️Inputs
        • Color Picker
        • Text input
        • Text area
        • Number input
        • Select input
        • Switch
        • Slider
        • Range slider
        • Pill selector
        • Input container
        • Dropdown container
      • 🖥️Display
        • Accordion
        • Alert
        • Color Swatch
        • Icon
        • Image
        • Avatar
        • Avatar Group
        • Loader
        • Pill
        • Spoiler
        • Stepper
        • Text
        • Title
      • 🧩Layout
        • App Container
        • Card
        • Flex
          • Flex Center
          • Styled Flex
        • Floating Toolbar
        • Grid
        • Header
        • Overflow Container
        • Space
      • 🗺️Navigation
        • App Nav
      • 🔼Overlays
        • Modal
        • Tooltip
        • Modal background
        • 📰Sheets
          • Bottom Sheet
          • Dynamic Sheet
          • Side Sheet
    • 🪝Hooks
      • UseColorScheme
      • UseColors
      • UseControlledList
      • UseDetectKeyDown
      • UseDisclosure
      • UseFloating
      • UseTooltip
      • UseBreakpoint
      • UseResponsiveProps
    • 🤚Generics
      • Generic button props
      • Generic input props
      • Generic Sheet Props
  • Valence Plugins
    • 🎠Valence Carousel
      • Carousel Child Props
  • Valence Utils
    • ✋Generics
      • Clickable
      • Events
      • Global
      • Grid
      • Layout
      • Overlay
      • Polymorphic
    • 🧜‍♀️Polymorphism
      • Polymorphic Button
      • Polymorphic Layout
      • Polymorphic Text
  • Update Notes
    • 3.0.0
    • 2.7.0
    • 2.6.0
    • 2.5.0
    • 2.4.0
    • 2.3.0
    • 2.2.0
    • 2.1.0
    • 2.0.0
Powered by GitBook
On this page
  • Usage
  • Font family
  • Styles
  • Supported markdown attributes
  • Props
  • Changelog

Was this helpful?

Edit on GitHub
  1. Valence Core
  2. Components
  3. Display

Text

Last updated: 2.2.0 (03/02/2024)

PreviousStepperNextTitle

Last updated 1 year ago

Was this helpful?

The Text component is a markdown-compatible paragraph wrapper that is particularly handy when dealing with formatting for internationalization.

This component forms the back-bone of all components that render text, including the , , , etc.

Usage

import { Text } from "@valence-ui/core";

function MyComponent() { 
    return ( 
        <Text>
            I'm a **markdown-compatible** text component!
        </Text>
    )
}

Font family

import { Text } from "@valence-ui/core";

function MyComponent() { 
    return ( 
        <Text
            family="Plus Jakarta Sans"
        >
            I'm a **markdown-compatible** text component!
        </Text>
    )
}

Styles

import { Text } from "@valence-ui/core";

function MyComponent() { 
    return ( 
        <Text
            bold
            italic
            monospace
            size="md"
            transform="uppercase"
            align="right"
        >
            I'm a **markdown-compatible** text component!
        </Text>
    )
}

After more specificity? The weight prop allows any CSS font-weight attribute, and the fontSize prop allows any font-size attribute.


Supported markdown attributes

  • - line break/newline

  • ***{...}*** - bold & italicized text

  • **{...}** - bold text

  • *{...}* - italicized text

  • `{...}` - monospace text

  • <hl>{...}</hl> - highlighted text


Props

Extends GenericProps, GenericClickableProps and PolymorphicTextProps.

Property
Type
Description

family

CSSProperties["fontFamily"]

Sets font-family css property.

weight

CSSProperties["fontWeight"]

Sets font-weight css property.

fontSize

CSSProperties["fontSize"]

Sets font-size css property.

align

CSSProperties["textAlign"]

Sets text-align css property.

transform

CSSProperties["textTransform"]

Sets text-transform css property.

size

ComponentSize

Sets the size of the text.

color

CSSProperties["color"]

Sets color css property.

italic

boolean

Shorthand for font-style: italic.

bold

boolean

Shorthand for font-weight: 800.

monospace

boolean

Shorthand for font-family: monospace.

highlightColor

CSSProperties["color"]

Sets the color of highlighted sections.

highlightStyle

CSSProperties

Optional styles to pass to highlighted sections.


Changelog

  • 2.2.0: Added the <hl> syntax, and the highlightColor and highlightStyle props.

The font family will need to be correctly installed before use. .

🧱
🖥️
Button
Alert
Pill
See more