Button behavior on an anchor
<traits.a of={[{ button }]} button:color="violet" href="/docs/">
Get started
</traits.a>Get started
Button behavior belongs to the anchor without changing its semantics.
A composition protocol for JSX
JSX Traits gives React elements an ordered, typed pipeline of plain functions with colocated, namespaced configuration.
Three traits
<traits.a of={[{ button }]} button:color="violet" href="/docs/">
Get started
</traits.a>Button behavior belongs to the anchor without changing its semantics.
<traits.a
of={[{ button }, { tooltip }]}
button:color="violet"
tooltip:content="Read the documentation"
tooltip:id="docs-tooltip"
href="/docs/"
>
Get started
</traits.a>The tooltip adds real markup and adopts the button color from symbol-keyed metadata.
<traits.span
of={[{ truncate }, { tooltip }]}
truncate:lines={1}
tooltip:id="project-name-tooltip"
>
A very long project name that will not fit
</traits.span>The tooltip reuses the original children published by the truncate trait.