Skip to content

supports the theme on clamp #2404

Open
Open
@arantespp

Description

@arantespp

Is your feature request related to a problem? Please describe.

We're using fluid typography in our projects with Theme UI, and we'd like to use a feature that supports the theme on clamp.

Describe the solution you'd like

It'd be nice to have something like this:

import { clamp } from 'theme-ui' // or something like "@theme-ui/fluid"

<Text sx={{
  fontSize: clamp(1, '4vw', 2) // if using array of font sizes
  fontSize: clamp('lg', '4vw', '2xl') // if using font sizes as object
}} />

Describe alternatives you've considered

Currently, we're using this way:

<Text sx={{
  fontSize: `clamp(${theme?.space?.lg}, '10vw', ${theme?.space?.xl)`
}} />

Additional context

I can implement this feature if it makes sense to Theme UI lib.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions