import type { HomarrCustomWidgetV2Input } from "./custom-jsx-schema";
export interface BundledCustomWidget {
id: "seed-dog-facts" | "seed-currency-exchange" | "seed-jellyfin" | "seed-pokedex" | "seed-tautulli-activity";
widget: HomarrCustomWidgetV2Input;
}
export const BUNDLED_CUSTOM_WIDGETS: readonly BundledCustomWidget[] = [
{
id: "seed-dog-facts",
widget: {
$schema: "homarr-custom-widget-v2",
name: "Random Dog Fact",
description: "Displays a random fun fact about dogs.",
sources: { default: { name: "Dog API", baseUrl: "https://dogapi.dog", networkScope: "public", auth: "none" } },
requests: { fact: { path: "/api/v2/facts", cacheSeconds: 30 } },
options: {},
template: `
Dog fact
{status.fact?.loading ? : status.fact?.error ? {status.fact.error} : {data.fact?.data?.[0]?.attributes?.body ?? "No dog fact was returned."}}
`,
},
},
{
id: "seed-currency-exchange",
widget: {
$schema: "homarr-custom-widget-v2",
name: "Currency Exchange",
description: "Converts an amount using European Central Bank exchange rates.",
sources: {
default: { name: "Frankfurter", baseUrl: "https://api.frankfurter.dev", networkScope: "public", auth: "none" },
},
requests: {
rates: {
path: "/v1/latest",
query: { from: { $option: "from" }, to: { $option: "to" }, amount: { $option: "amount" } },
cacheSeconds: 300,
},
},
options: {
from: { label: "From currency", control: "text", default: "JPY" },
to: {
label: "Target currencies",
description: "Comma-separated currency codes",
control: "text",
default: "EUR,USD",
},
amount: { label: "Amount", control: "number", default: 50, min: 0 },
},
template: `
{options.amount} {options.from}{data.rates?.date ?? "Latest"}
{status.rates?.loading ? : status.rates?.error ? {status.rates.error} : {Object.entries(data.rates?.rates ?? {}).map(entry => {entry[0]}{entry[1]})}}
`,
},
},
{
id: "seed-jellyfin",
widget: {
$schema: "homarr-custom-widget-v2",
name: "Jellyfin Library",
description: "Counts movies, series, episodes, and songs in a Jellyfin library.",
iconUrl: "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/svg/jellyfin.svg",
sources: {
default: {
name: "Jellyfin",
baseUrl: "http://jellyfin.local",
networkScope: "private",
auth: { type: "apiKeyHeader", name: "X-Emby-Token" },
},
},
requests: { counts: { path: "/Items/Counts", cacheSeconds: 60 } },
options: {},
template: `
Jellyfin library
{status.counts?.loading ? : status.counts?.error ? {status.counts.error} : {[{ label: "Movies", value: data.counts?.MovieCount }, { label: "Series", value: data.counts?.SeriesCount }, { label: "Episodes", value: data.counts?.EpisodeCount }, { label: "Songs", value: data.counts?.SongCount }].map(item => {item.label}{item.value ?? 0})}}
`,
},
},
{
id: "seed-pokedex",
widget: {
$schema: "homarr-custom-widget-v2",
name: "Pokédex",
description: "Browse Pokémon and open a responsive detail view.",
iconUrl: "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/items/poke-ball.png",
sources: { default: { name: "PokeAPI", baseUrl: "https://pokeapi.co", networkScope: "public", auth: "none" } },
requests: {
pokemon: {
path: "/api/v2/pokemon",
query: { limit: { $option: "limit" }, offset: { $option: "offset" } },
cacheSeconds: 300,
},
detail: { path: "/api/v2/pokemon/{param:name}", trigger: "manual", cacheSeconds: 300 },
},
options: {
limit: { label: "Pokémon to load", control: "number", default: 24, min: 1, max: 100 },
offset: { label: "Start at Pokédex number", control: "number", default: 0, min: 0, advanced: true },
accent: { label: "Accent color", control: "color", default: "red" },
},
template: `
PokédexExplore species, types, abilities, and base stats
{data.pokemon?.count?.toLocaleString() ?? "—"} species
{status.pokemon?.loading ? {[1, 2, 3, 4].map(item => )} : status.pokemon?.error ? {status.pokemon.error} : (data.pokemon?.results ?? []).filter(pokemon => pokemon.name.toLowerCase().includes(String(inputs.search ?? "").toLowerCase())).length === 0 ? Try another name or increase the result limit in widget options. : {(data.pokemon?.results ?? []).filter(pokemon => pokemon.name.toLowerCase().includes(String(inputs.search ?? "").toLowerCase())).map(pokemon => } triggerContent={{pokemon.name}#{String(pokemon.url.split("/").slice(-2, -1)[0]).padStart(3, "0")}Details}>{(detail) => {detail.name}{(detail.types ?? []).map(type => {type.type?.name})}Height {detail.height / 10} m · Weight {detail.weight / 10} kgAbilities: {(detail.abilities ?? []).map(ability => ability.ability?.name?.replace("-", " ")).join(", ")}{(detail.stats ?? []).map(stat => {stat.stat?.name?.replace("-", " ")}{stat.base_stat})}})}}
`,
},
},
{
id: "seed-tautulli-activity",
widget: {
$schema: "homarr-custom-widget-v2",
name: "Tautulli Activity",
description: "Shows active Plex streams from Tautulli.",
sources: {
default: {
name: "Tautulli API",
baseUrl: "http://tautulli.local",
networkScope: "private",
auth: { type: "apiKeyQuery", name: "apikey" },
},
},
requests: { activity: { path: "/api/v2", query: { cmd: "get_activity" }, cacheSeconds: 15 } },
options: {},
template: `
Tautulli ActivityLive streaming sessions
{status.activity?.loading ? : status.activity?.error ? {status.activity.error} : (data.activity?.response?.data?.sessions ?? []).length === 0 ? All quiet. : <>
Active streams{(data.activity?.response?.data?.sessions ?? []).length}
Total bandwidth{((data.activity?.response?.data?.sessions ?? []).reduce((sum, session) => sum + (session.bandwidth || 0), 0) / 1000000).toFixed(1)} Mbps
Direct play{(data.activity?.response?.data?.sessions ?? []).filter(session => session.transcode_decision === "direct play" || session.transcode_decision === "copy").length}
Transcodes{(data.activity?.response?.data?.sessions ?? []).filter(session => session.transcode_decision === "transcode").length}
{(data.activity?.response?.data?.sessions ?? []).map(session => {session.user}{session.state}{session.player}{session.full_title}{session.transcode_decision}{session.bandwidth ? (session.bandwidth / 1000000).toFixed(1) + " Mbps" : "—"}{session.location})}
>}
`,
},
},
] as const;