feat(tabs): add icon support for tabs (#926)
* feat(tabs): add icon support for tabs - Introduced an `icon` property for tabs to display icons alongside tab labels. - Updated the tabs shortcode and HTML partials to accommodate the new icon feature. - Enhanced documentation for tabs to include examples of using icons in tab definitions. * chore: rebuild css * doc(tabs): add icon support in tab documentation for multiple languages - Enhanced documentation for tabs to include examples of using the `icon` parameter in Persian, Japanese, and Simplified Chinese. - Updated the tab shortcode examples to demonstrate how to display icons alongside tab labels. * chore: regenerate compiled css * fix(a11y): add aria-hidden to decorative tab icons Add aria-hidden="true" to tab icon SVGs so screen readers skip decorative icons and only announce the tab name. Update @example docblock in tab.html to demonstrate the icon parameter. * doc(tabs): improve icon section with better examples and icon page link Rename "Tabs With Icons" heading to "Add Icons" for consistency with other action-oriented section titles. Replace JSON/YAML/TOML icon example with Photos/Music/Videos using photograph, music-note, and film icons that naturally match their labels. Add link to the Icon shortcode page so users can discover available icon names.
This commit is contained in:
@@ -2,13 +2,16 @@
|
||||
Create a tab.
|
||||
|
||||
@param {string} name The name of the tab.
|
||||
@param {string} icon The icon of the tab.
|
||||
@param {string} selected Whether the tab is selected.
|
||||
|
||||
@example {{< tab name="Foo" selected=true >}}content{{< /tab >}}
|
||||
@example {{< tab name="Foo" icon="document-text" selected=true >}}content{{< /tab >}}
|
||||
*/ -}}
|
||||
|
||||
{{- $name := .Get "name" | default (printf "Tab %d" .Ordinal) -}}
|
||||
|
||||
{{- $icon := .Get "icon" -}}
|
||||
|
||||
{{- $selected := .Get "selected" -}}
|
||||
{{- if .Parent.Get "defaultIndex" -}}
|
||||
{{- $selected = eq .Ordinal (int (.Parent.Get "defaultIndex")) -}}
|
||||
@@ -18,6 +21,7 @@ Create a tab.
|
||||
{{ .Parent.Store.Set "tabs" ($tabs | append (dict
|
||||
"id" .Ordinal
|
||||
"name" $name
|
||||
"icon" $icon
|
||||
"content" .InnerDeindent
|
||||
"selected" $selected
|
||||
))
|
||||
|
||||
Reference in New Issue
Block a user