Sources
Overrides
Pin markup to a name.
import { override } from '@munsonlabs/sigil'
// markup
override('logo', '<svg viewBox="0 0 24 24">…</svg>')
// several at once
override({
heart: '<svg …>',
check: '<svg …>',
})
// a factory, per variant
override('star', ({ variant }) => (variant === 'active' ? STAR_FILLED : STAR))
// remove
override('logo', null)
An override beats every library, so it is also how you replace one icon a library would otherwise supply.
Loading…
Scoped to one library
{ library } pins the override to that library's names only - it never touches another library's icon of the same name, even if both use it:
override('play', '<svg …>', { library: 'mlv' })
This is how a component embedded on someone else's page - a player, a widget - replaces its own icons without a prefix: pin under the library's own name (library="mlv" on the tag already does that for use()), and a scoped override closes the other collision, a host's own override('play', …) for their page. See pinning a library.