Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@zendeskgarden/container-tabs
Advanced tools
This package includes containers relating to tabs in the Garden Design System.
npm install @zendeskgarden/container-tabs
For live examples check out our storybook.
import { useTabs } from '@zendeskgarden/container-tabs';
const tabs = ['Tab 1', 'Tab 2', 'Tab 3'];
const tabRefs = tabs.map(() => createRef(null));
const Tabs = () => {
const { selectedItem, getTabProps, getTabListProps, getTabPanelProps } = useTabs();
const tabComponents = [];
const tabPanels = [];
tabs.forEach((tab, index) => {
tabComponents.push(
<li
{...getTabProps({
item: tab,
index,
ref: tabRefs[index],
key: tab,
style: {
borderBottom: `3px solid ${tab === selectedItem ? '#1f73b7' : 'transparent'}`
}
})}
>
{tab}
</li>
);
tabPanels.push(
<div
{...getTabPanelProps({
index,
item: tab,
key: tab,
style: {
padding: '10px 0',
borderTop: '1px solid'
}
})}
>
{tab} Content
</div>
);
});
return (
<>
<ul
{...getTabListProps({
style: {
display: 'flex'
}
})}
>
{tabComponents}
</ul>
{tabPanels}
</>
);
};
import { TabsContainer } from '@zendeskgarden/container-tabs';
const Tabs = () => {
const tabComponents = [];
const tabPanels = [];
return (
<TabsContainer>
{({ selectedItem, getTabProps, getTabListProps, getTabPanelProps }) => {
tabs.forEach((tab, index) => {
tabComponents.push(
<li
{...getTabProps({
item: tab,
index,
ref: tabRefs[index],
key: tab,
style: {
borderBottom: `3px solid ${tab === selectedItem ? '#1f73b7' : 'transparent'}`
}
})}
>
{tab}
</li>
);
tabPanels.push(
<div
{...getTabPanelProps({
index,
item: tab,
key: tab,
style: {
padding: '10px 0',
borderTop: '1px solid'
}
})}
>
{tab} Content
</div>
);
});
return (
<>
<ul
{...getTabListProps({
style: {
display: 'flex'
}
})}
>
{tabComponents}
</ul>
{tabPanels}
</>
);
}}
}
</TabsContainer>
);
};
FAQs
Containers relating to tabs in the Garden Design System
The npm package @zendeskgarden/container-tabs receives a total of 9,340 weekly downloads. As such, @zendeskgarden/container-tabs popularity was classified as popular.
We found that @zendeskgarden/container-tabs demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.