Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@ngheadlessui/tabs
Advanced tools
Easily create accessible, fully customizable tab interfaces, with robust focus management and coming keyboard navigation support.
Easily create accessible, fully customizable tab interfaces, with robust focus management and coming keyboard navigation support.
# npm
npm install @ngheadlessui/tabs
# Yarn
yarn add @ngheadlessui/tabs
# import the lib into module you want to use it in
import { UiTabsModule } from '@ngheadlessui/tabs';
Tabs are built using the headless-tab-group, headless-tab, and headlessTabPanel components. By default the first tab is selected, and clicking on any tab will activate the corresponding panel.
<headless-tab-group>
<div>
<headless-tab>Tab 1</headless-tab>
<headless-tab>Tab 2</headless-tab>
<headless-tab>Tab 3</headless-tab>
</div>
<!-- You can use the headlessTabPanel as a component -->
<headlessTabPanel>Content 1</headlessTabPanel>
<headlessTabPanel>Content 2</headlessTabPanel>
<headlessTabPanel>Content 3</headlessTabPanel>
<!--or as a directive
<div headlessTabPanel>Content 1</div>
<div headlessTabPanel>Content 2</div>
<div headlessTabPanel>Content 3</div>
-->
</headless-tab-group>
This is a headless component so there are no styles included by default. Instead, the components expose useful information via bound classes that you can use to apply styles yourself.
To style the selected Tab, use the selected class selected-headless-tab
, which tells you whether or not that tab is currently selected. For flexiblity, the clas unselected-headless-tab
is also available for use.
.selected-headless-tab {
@apply bg-white shadow;
}
.unselected-headless-tab {
@apply text-blue-100 hover:bg-white/[0.12] hover:text-white;
}
To disable a tab, use the disabled input property on the headlessTabPanel
component. Disabled tabs cannot be selected with the mouse.
<headless-tab-group>
<div>
<headless-tab [disabled]="true">Tab 1</headless-tab>
<headless-tab>Tab 2</headless-tab>
<headless-tab>Tab 3</headless-tab>
</div>
<headlessTabPanel>Content 1</headlessTabPanel>
<headlessTabPanel>Content 2</headlessTabPanel>
<headlessTabPanel>Content 3</headlessTabPanel>
</headless-tab-group>
<!-- If you are creating tabs from component data -->
<headless-tab-group>
<div>
<headless-tab
*ngFor="let tabName of ['Recent', 'Popular', 'Trending']"
[disabled]="tabName === 'Recent'"
>
{{ tabName }}
</headless-tab>
</div>
<headlessTabPanel>Content 1</headlessTabPanel>
<headlessTabPanel>Content 2</headlessTabPanel>
<headlessTabPanel>Content 3</headlessTabPanel>
</headless-tab-group>
To style disabled tabs, use the disabled class disabled-headless-tab
, which tells you whether or not that tab is currently disabled.
.disabled-headless-tab {
@apply text-red-300 bg-yellow-700 hover:bg-white/[0.12] hover:text-white;
}
To change which tab is selected by default, use the defaultTabIndex="number" property on the TabGroup component.
<headless-tab-group [defaultTabIndex]="2">
<div>
<headless-tab>Tab 1</headless-tab>
<headless-tab>Tab 2</headless-tab>
<headless-tab>Tab 3</headless-tab>
</div>
<headlessTabPanel>Content 1</headlessTabPanel>
<headlessTabPanel>Content 2</headlessTabPanel>
<headlessTabPanel>Content 3</headlessTabPanel>
</headless-tab-group>
To run a function whenever the selected tab changes, listen to emissions from the (changeTab) EventEmitter on the TabGroup component. (changeTab) emits the index ($event) of the active tab.
<headless-tab-group (changeTab)="listenToChangeInTabs($event)">
<div>
<headless-tab>Tab 1</headless-tab>
<headless-tab>Tab 2</headless-tab>
<headless-tab>Tab 3</headless-tab>
</div>
<headlessTabPanel>Content 1</headlessTabPanel>
<headlessTabPanel>Content 2</headlessTabPanel>
<headlessTabPanel>Content 3</headlessTabPanel>
</headless-tab-group>
The main TabGroup component.
Props | Default | Description |
---|---|---|
defaultIndex | 0 | Number The default selected index |
(changeTab) | EventEmitter This is fired when there is a change in selected tab |
The Tab component.
Props | Default | Description |
---|---|---|
disabled | false | Boolean Whether or not the Tab is currently disabled. |
The Tab component.
Props | Default | Description |
---|---|---|
id | undefined | String unique identifier of the tab component |
FAQs
Easily create accessible, fully customizable tab interfaces, with robust focus management and coming keyboard navigation support.
The npm package @ngheadlessui/tabs receives a total of 0 weekly downloads. As such, @ngheadlessui/tabs popularity was classified as not popular.
We found that @ngheadlessui/tabs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.