facet#
facet is our internal library for making client apps. Think of it as our version of Tailwind/Nativewind. Yes, it is confusingly clashing with an ATProto text facet, but you can always import it as something else.
Usage#
facet provides the following hooks to help make building a consistent design easier.
useFacet(), which provides the entire Facet library object, containing all the values listed below.useVariant(), which provides aFacetVariantobject containing the colours defined for our application based on aFacetPaletteobject.useAtoms(), which provides aFacetAtomsobject, containing consistent values for shadows, borders, radii, layout, and positioning.useTypography(), which provides aFacetTypographyobject, containing consistent values for all things text-related.
facet also exports a provider, the FacetProvider, which must be wrapped around the root of your application (or similar) to access the values.
Setup#
- Create a new
Facetby calling the generator and providing any options in the shape of aFacetOptsobject.const facet = generateFacet(). - Provide the
Facetas a prop to theFacetProvider.<FacetProvider facet={facet}>...</FacetProvider> - Use the hooks elsewhere in your application.
Configuration#
If no options object is passed to the Facet constructor, it will use the values defined for Gemstone's client app. In general, any value not passed in the initial constructor object will be replaced with these values as well.