The look is yours, the state is an attribute

5 min·Assumes: styling

Your select works. It opens, it picks, it talks to screen readers. It also looks like plain HTML from 1998. Here is how you give it a look.

@markless/ui ships no stylesheet. Instead, each part writes its state onto its own element as a ui-* attribute. You put a class on the part, and a plain CSS selector does the rest.

A class and an attribute

Open the picker. Pick Ink, then open it again. Try to pick Neon.

PlaygroundRestored your edit
Try thisIn the .picker[ui-open] .trigger rule, change the background to plum. Open the picker: the trigger turns plum while the list is open.

The trigger turned yellow while the list was open, because .picker[ui-open] .trigger matched. Ink went bold because its option gained ui-selected. Neon looks faded because it carries ui-disabled. No line of TypeScript adds or removes a class. The family writes the attribute, and your stylesheet reads it.

Most of these attributes are on/off flags with no value. ui-open is on the element while the state holds, and gone when it does not. So [ui-open] is the whole selector.

A few attributes carry a value instead. An accordion item writes its own value, so [ui-value='returns'] reaches that one section:

.section[ui-value='returns'][ui-open] {
	border-color: rebeccapurple;
}

Your class names stay yours

The <style> block in a component belongs to that file. Markless scopes it, so a .picker here cannot collide with a .picker two folders away. A class you put on a family part still reaches it. The tooltip and accordion tests check exactly that, in the browser alone and from server HTML.

These are the same scoping rules your own components already get.

Defaults you can beat

A few families need some CSS to work at all. A tooltip has to sit next to its trigger. A drawer's backdrop has to cover the page. Sixteen families ship that CSS inside a CSS layer named markless. They are colorpicker, crop, drawer, gridlist, hovercard, ink, menu, menubar, pad, popover, rating, resizable, table, tokenbox, tooltip and tour.

A rule in a layer loses to any rule outside a layer. So one plain rule of yours beats the default, with no !important and no specificity fight.

Here is the line in the tooltip's own CSS that places the tip. It puts the tip above its trigger:

@layer markless {
	[overlay] {
		position-area: block-start;
	}
}

This tip has one rule of yours on it, position-area: inline-end. That is enough to move it to the right of Save:

PlaygroundRestored your edit
Try thisChange position-area: inline-end to block-end. The tip moves below Save, because your rule still beats the default in the layer.

Whose rule places the tip?

@layer markless
[overlay] { position-area: block-start;}
your rule
.tip { position-area: inline-end;}
SaveKeeps a copy in your drafts
WatchYour rule is off. The layered default puts the tip above Save.

You moved the tip with CSS, not a prop. The tooltip has no prop for where it sits. Placement lives in CSS, where your rule can change it.

Parts that nest

A tree or a submenu does not need new parts for the next level down. It uses the same ones again. A tree.item holds a tree.itemcontent, and that holds more tree.items. Each nested item keeps its own open or closed state, and the same CSS styles every level.

Click the arrow next to src. Then use the arrow keys to walk the rows.

PlaygroundRestored your edit
README.md
Try thisAdd a third leaf under src, such as styles.css at level 2. Open src, then walk to the new row with the arrow keys.

index.ts and app.tsrx use the same tree.item part as src, one level down. The .arrow[ui-open] rule turns the arrow on any row at any depth. Menus nest the same way: a submenu is a menu.itemcontent written inside a menu.item.

Next: pick a family from the overview and style it.