skip section navigation

URLButton

URLButton presents a destination with a readable name and a shorter address. it opens the actual href in a new tab; displayUrl is only the text shown beneath the label.

Loafkit source on GitHub
github.com/ciabi/loafkit

usage

svelte
<script>
	import { URLButton } from '@ciabi/loafkit-ui';
	import imageSrc from '$lib/assets/flavorartwork/skypiea.gif';
</script>

<URLButton href="https://github.com/ciabi/loafkit" displayUrl="github.com/ciabi/loafkit"
	label="Loafkit source on GitHub" {imageSrc} />

image discovery

without imageSrc, URLButton attempts a browser fetch of the destination to find social metadata or icons, then tries a favicon fallback. cross-origin restrictions can prevent that metadata read. discovery is best-effort and doesn’t guarantee a thumbnail.

let the destination supply its image

Loafkit repository preview
github.com/ciabi/loafkit
svelte
<script lang="ts">
import { URLButton } from '@ciabi/loafkit-ui';
</script>

<URLButton href="https://github.com/ciabi/loafkit" displayUrl="github.com/ciabi/loafkit" label="Loafkit repository preview" />

API reference

URLButton

Component
href

actual destination opened in a new tab.

displayUrl

short address shown beneath the label.

label

visible destination name and anchor accessible name.

imageSrc

explicit preview image, avoiding metadata discovery.

class
Default: ''

extra classes on the component root.

style

inline styles on the component root.