defuss-shadcn / Website / Search & Navigation / tag-cloud
Built with: CSS
Tag CloudBLK
Displays linked tags with optional frequency-based emphasis - five weights from data-weight, or even pills with counts. Part of the Search & Navigation blocks.
On this page (3)
§Cloud
Tag links sized in five steps by data-weight (frequency buckets); the count is in the text for screen readers.
§Pills
data-variant='pills': even pills with the count visible.
§CSS view file
/* -- Tag Cloud (website · Search & Navigation) ---------------------------- Displays linked tags with optional frequency-based emphasis - five weights from data-weight, or even pills with counts. */@layer components { /* every box in the block measures border-box - the same on any page */ :where(.mk-tag-cloud, .mk-tag-cloud *, .mk-tag-cloud ::before, .mk-tag-cloud ::after) { box-sizing: border-box; } .mk-tag-cloud { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.375rem 0.875rem; max-width: 32rem; margin: 0; padding: 0; list-style: none; & a { color: var(--muted-foreground); text-decoration: none; line-height: 1.2; } & a:hover { color: var(--primary); text-decoration: underline; text-underline-offset: 3px; } & a:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: var(--radius-sm); } & a[data-weight="1"] { font-size: 0.8125rem; opacity: 0.8; } & a[data-weight="2"] { font-size: 0.9375rem; } & a[data-weight="3"] { font-size: 1.125rem; color: var(--foreground); } & a[data-weight="4"] { font-size: 1.375rem; color: var(--foreground); font-weight: 600; } & a[data-weight="5"] { font-size: 1.75rem; color: var(--foreground); font-weight: 700; letter-spacing: -0.02em; } } .mk-tag-cloud[data-variant="pills"] { gap: 0.5rem; align-items: center; & a { display: inline-flex; align-items: center; gap: 0.375rem; padding: 0.25rem 0.375rem 0.25rem 0.75rem; border: 1px solid var(--border); border-radius: 999px; color: var(--foreground); font-size: 0.8125rem; font-weight: 500; opacity: 1; letter-spacing: 0; } & a:hover { border-color: var(--primary); text-decoration: none; } & small { padding: 0.0625rem 0.375rem; border-radius: 999px; background: var(--muted); color: var(--muted-foreground); font-size: 0.6875rem; font-variant-numeric: tabular-nums; } } /* -- Accessibility ------------------------------------------- */ @media (forced-colors: active) { .mk-tag-cloud a { color: LinkText; } }}Comments, ideas or improvements? Edit this page's source on GitHub