Yeti with UI libraries

Yeti gives you layout, type, color, and the components a browser can run by itself. A UI library gives you the ones that need a lot of script. This section shows how to use the two together, where one ends and the other starts, and how little it takes to make them look like one thing.

What Yeti leaves to others

Yeti does layout, type, spacing, color, and the components the browser can already drive: buttons, fields, dialogs, tabs, dropdowns, accordions, tables. It stops where a part needs a lot of script to work at all. A tag input, a searchable list, a color picker, a tree, a split panel, a date range and a command list are all other people's jobs.

Zero build is how Yeti ships, not a rule about your project. A Yeti page with no build step can use any of these libraries from a script tag. A React app with a build can use Yeti too.

Three owners

Every page that pairs the two has three owners, and most confusion comes from not knowing which one to ask.

Owner What it decides
Yeti The page: layout, spacing, type, color, light and dark, and every part that is Yeti's own
The library Its own parts: what they contain, how they behave, the keyboard, what they tell a screen reader
The bridge The values that cross over, so the library's parts use the page's color, corners, height and type

The bridge is a short stylesheet you own. It sets the library's custom properties to Yeti's tokens. It holds no colors of its own, so when you change a Yeti token, or the visitor switches to dark, both sides follow.

How pairing works

  1. Load the library's stylesheet before Yeti's. Cascade layers are ranked in the order the browser first meets them. A layered library that comes first ranks below Yeti, and cannot take over the page's font, text color or color scheme. If its stylesheet has no layers, its rules beat Yeti's wherever you put it, so check what it styles.
  2. Load the bridge after both.
  3. Load the library's script.
  4. Look at it in light, in dark, and with a popup open. Those three find most of what goes wrong.

Pin an exact version of the library. The bridge depends on the names it gives its custom properties, parts and classes.

Sealed and open

How far Yeti reaches into a library's parts depends on how they are built.

Sealed parts live in a shadow root. Yeti's rules stop at the edge. Inherited type and color get in, custom properties get in, and you can style the parts the library names with ::part(). Anything you slot in from outside stays yours. Web Awesome and Cally are sealed.

Open parts are ordinary elements on your page. Yeti's base styles reach the input and the button inside, and you can put Yeti's own classes on them. UI SDK, Choices.js and PhotoSwipe are open.

Sealed parts are safer, and you get the look they came with. Open parts bend further, and it is up to you to check what Yeti does to them.

Which to pick

  • You want finished parts and little work. Web Awesome: a full set of sealed components, from one script tag.
  • You want the behavior and your own markup. UI SDK: it runs the keyboard and the state, and you bring the elements and the look. Works from a script tag or inside a React build. It is in beta.
  • You need one thing. Small widgets: a calendar, a searchable select or a lightbox, each from a small library that does only that.

Judging anything else

A library that is not listed will probably sit well beside Yeti if:

  • its class and tag names carry a prefix, or its styles are sealed in shadow roots
  • it has no global reset, and no rules on bare elements such as button and input
  • its look is set with custom properties
  • it is still maintained

Sets built on Tailwind are a poor fit. Tailwind's Preflight resets bare elements, which is the layer Yeti styles. The class names collide too: daisyUI 5.8.2 defines card, badge, alert, table, tabs, dropdown, tooltip, hero, carousel and stack, and so does Yeti.

Every library in this section was run on a page with Yeti before it was written about. Each page says which versions, and what was not tested.