-
-
Notifications
You must be signed in to change notification settings - Fork 578
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add icon support to the
<TabItem>
component (#1568)
* feat: add `icon` prop to the `<TabItem>` component * docs: split `icon` attribute in a new sentence Co-authored-by: Chris Swithinbank <swithinbank@gmail.com> --------- Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
- Loading branch information
Showing
6 changed files
with
53 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@astrojs/starlight': minor | ||
--- | ||
|
||
Adds support for optionally setting an icon on a `<TabItem>` component to make it easier to visually distinguish between tabs. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,19 @@ | ||
--- | ||
import { TabItemTagname } from './rehype-tabs'; | ||
import type { Icons } from '../components/Icons'; | ||
interface Props { | ||
icon?: keyof typeof Icons; | ||
label: string; | ||
} | ||
const { label } = Astro.props; | ||
const { icon, label } = Astro.props; | ||
if (!label) { | ||
throw new Error('Missing prop `label` on `<TabItem>` component.'); | ||
} | ||
--- | ||
|
||
<TabItemTagname data-label={label}> | ||
<TabItemTagname data-label={label} data-icon={icon}> | ||
<slot /> | ||
</TabItemTagname> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters