🎬The ValenceProvider

Last updated: 2.6.0 (09/06/2024)

The ValenceProvider provides every component in your app with the relevant styling and default values that they require to function correctly.

Within the root app file (usually App.tsx or App.jsx), import and add the ValenceProvider:

App.tsx
import { ValenceProvider } from "@valence-ui/core"

function App() {
  return ( 
    <>
      <ValenceProvider>
        {/* Your app here */}
      </ValenceProvider>
    </>
  )
}

export default App;

Modifying default attributes

Every value that the ValenceProvider supplies to your app can be modified by passing in props to the component:

App.tsx
import { ValenceProvider } from "@valence-ui/core"

function App() {
  return ( 
    <>
      <ValenceProvider
        breakpoints={{
          mobileWidth: 480,
          tabletWidth: 768,
          desktopLargeWidth: 1024,
          tvWidth: 1440,
        }}
      >
        {/* Your app here */}
      </ValenceProvider>
    </>
  )
}

export default App;

Props

colors

Type:

Color[]

Default value:

DEFAULT_PALETTE

Description:

A list of all colors to use.

primaryColor

Type:

string

Default value:

"pink"

Description:

The primary color to default upon.

preferredColorScheme

Type:

PreferrableColorScheme ("light" | "dark" | "system")

Default value:

"system"

Description:

The user's preferred color scheme.

defaults

Type:

Default value:

Description:

Default sizes and parameters for common attributes.

fontFamily

Type:

Default value:

Description:

The default font families to use in specific contexts.

getFont()

Type:

Description:

Finds a font family within the theme context.

sizeClasses

Type:

Default value:

Description:

Standardised sizing guide to use for components.

getSize()

Type:

Description:

Finds a size within the theme context.

titles

Type:

Default value:

Description:

Props to refer to for titles.

breakpoints

Type:

Default value:

Description:

Breakpoints to use for determining breakpoint-sensitive props.

Last updated

Was this helpful?