OneScript

fontWeight

Set an inheritable font weight.

fontWeight(value) accepts a FontWeight value. It inherits through container views and overrides the weight supplied by the current font.

import { Font, FontWeight, Modifier, Text, VStack } from "onescript/views"

<VStack modifier={Modifier
  .font(Font.body)
  .fontWeight(FontWeight.medium)}>
  <Text>Inherited medium weight</Text>
  <Text modifier={Modifier.fontWeight(FontWeight.bold)}>Bold override</Text>
</VStack>
ValueRelative weight
FontWeight.ultraLight100
FontWeight.thin200
FontWeight.light300
FontWeight.regular400
FontWeight.medium500
FontWeight.semibold600
FontWeight.bold700
FontWeight.heavy800
FontWeight.black900

How is this guide?

Last updated on