carbon-components-angular
Version:
Next generation components
81 lines (77 loc) • 3.12 kB
TypeScript
/**
*
* carbon-angular v0.0.0 | content-switcher.component.d.ts
*
* Copyright 2014, 2026 IBM
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { QueryList, EventEmitter, AfterViewInit, ElementRef, OnChanges, SimpleChanges } from "@angular/core";
import { ContentSwitcherOption } from "./content-switcher-option.directive";
import * as i0 from "@angular/core";
/**
* The content switcher can be used for toggling between distinct options.
* Similar to tabs, but without an associated content panel.
*
* Get started with importing the module:
*
* ```typescript
* import { ContentSwitcherModule } from 'carbon-components-angular';
* ```
*
* ```html
* <cds-content-switcher (selected)="selected($event)">
* <button cdsContentOption>First section</button>
* <button cdsContentOption>Second section</button>
* <button cdsContentOption>Third section</button>
* </cds-content-switcher>
* ```
*
* [See demo](../../?path=/story/components-content-switcher--basic)
*/
export declare class ContentSwitcher implements AfterViewInit, OnChanges {
protected elementRef: ElementRef;
ariaLabel: string;
/**
* Set content switcher size
*/
size: "sm" | "md" | "lg";
/**
* Specify whether the ContentSwitcher should be the low contrast variant.
*/
lowContrast: boolean;
/**
* When `automatic`, the focused switcher will be selected by default. For `manual`,
* user will have to manually select via Enter/space (which fire the native click handler).
*
* Passes selected mode to all content switcher children
*/
selectionMode: "automatic" | "manual";
/**
* Index of the currently selected option (zero-based). When set, the
* matching `cdsContentOption` is activated and any other option becomes
* inactive.
*/
selectedIndex: number | undefined;
/**
* Emits the activated `ContentSwitcherOption`
*/
selected: EventEmitter<ContentSwitcherOption>;
options: QueryList<ContentSwitcherOption>;
constructor(elementRef: ElementRef);
ngOnChanges(changes: SimpleChanges): void;
ngAfterViewInit(): void;
hostkeys(event: KeyboardEvent): void;
private applySelectedIndex;
static ɵfac: i0.ɵɵFactoryDeclaration<ContentSwitcher, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<ContentSwitcher, "cds-content-switcher, ibm-content-switcher", never, { "ariaLabel": "ariaLabel"; "size": "size"; "lowContrast": "lowContrast"; "selectionMode": "selectionMode"; "selectedIndex": "selectedIndex"; }, { "selected": "selected"; }, ["options"], ["*"], false>;
}