Source chip
A numbered link to a source, with the host name beside it.
Example
<focsd-source-chip href="https://www.w3.org/WAI/ARIA/apg/patterns/feed/" label="Feed pattern" index="1"></focsd-source-chip>Usage
Import the module once, then use the tag like any HTML element. Every framework below renders the same element; see Frameworks for setup.
<script type="module"> import '@focsd-dev/ai';</script>
<focsd-source-chip href="https://www.w3.org/WAI/ARIA/apg/patterns/feed/" label="Feed pattern" index="1"></focsd-source-chip>import { useEffect, useRef } from 'react';import '@focsd-dev/ai';
export function Example() { const ref = useRef(null); return <focsd-source-chip ref={ref} href="https://www.w3.org/WAI/ARIA/apg/patterns/feed/" label="Feed pattern" index="1"></focsd-source-chip>;}<script setup>import '@focsd-dev/ai';</script>
<template> <focsd-source-chip href="https://www.w3.org/WAI/ARIA/apg/patterns/feed/" label="Feed pattern" index="1"></focsd-source-chip></template>// Add CUSTOM_ELEMENTS_SCHEMA to the component's schemas, then:import '@focsd-dev/ai';
// template<focsd-source-chip href="https://www.w3.org/WAI/ARIA/apg/patterns/feed/" label="Feed pattern" index="1"></focsd-source-chip><script> import '@focsd-dev/ai';</script>
<focsd-source-chip href="https://www.w3.org/WAI/ARIA/apg/patterns/feed/" label="Feed pattern" index="1"></focsd-source-chip>API
Attributes
| Attribute | Property | Type | Default |
|---|---|---|---|
href | href | string | — |
label | label | string | — |
index | index | number | 0 |
CSS parts
Style the inside of the component with ::part(), for example focsd-source-chip::part(link).
| Part | Description |
|---|---|
link | The link (a plain span when the URL is not allowed). |
index | The "[n]" number. |
host | The host name. |
Accessibility
- A real link named "[1] Feed pattern", underlined, with the host name in muted text.
- Only
https:,http:,mailto:and relative URLs become links. Any other scheme (javascript:,data:) is shown as text, not a link. Links getrel="noopener noreferrer nofollow"and never settarget.
Keyboard
| Key | Action |
|---|---|
| Enter | Follow the link |
Ask the docs
Hi, what are you building?
Ask about any component, theming, forms or frameworks. I answer with the right component, a snippet and a link to its docs.