A menu is a floating panel that displays a list of actions or navigational items.
import { DaffMenuComponent } from '@daffodil/design/menu'
The floating panel that contains menu items.
@Component()
class DaffMenuComponent implements AfterContentInit, AfterViewInit {}
import { DaffMenuItemComponent } from '@daffodil/design/menu'
Individual clickable items within the menu. Applied to <button> or <a> elements.
@Component()
class DaffMenuItemComponent implements FocusableOption {
focus(): void
}
voidFocus the menu item.
import { DaffMenuActivatorDirective } from '@daffodil/design/menu'
Directive that triggers the menu to open/close. Applied to the button that activates the menu. The selector doubles as an input for the menu content to display.
@Directive()
class DaffMenuActivatorDirective implements OnDestroy {
readonly isOpen: WritableSignal<boolean> = signal(false)
daffMenuActivator: InputSignal<TemplateRef<unknown> | Type<unknown>>
id: InputSignal<string>
xPosition: InputSignal<DaffMenuXPosition> = 'after'
yPosition: InputSignal<DaffMenuYPosition> = 'below'
}
InputSignal<TemplateRef<unknown> | Type<unknown>>| Default | |
|---|---|
| Description | The menu content to display when activated. |
InputSignal<string>| Default | |
|---|---|
| Description | An optional ID for the activator.
When set, the menu's ID is derived as |
InputSignal<DaffMenuXPosition>| Default | 'after' |
|---|---|
| Description | The horizontal alignment of the menu relative to the activator. Defaults to |
InputSignal<DaffMenuYPosition>| Default | 'below' |
|---|---|
| Description | The vertical position of the menu relative to the activator. Defaults to |
import { DaffMenuService } from '@daffodil/design/menu'
@Injectable()
class DaffMenuService {
open$: Observable<boolean> = this.$_open.asObservable()
close(): void
open(
activator: ViewContainerRef
component: DaffMenuSlot
config?: DaffMenuConfig
): void
}
voidvoid| Parameter | activator: ViewContainerRef |
|---|---|
| Description |
| Parameter | component: DaffMenuSlot |
|---|---|
| Description |
| Parameter | config: DaffMenuConfig |
|---|---|
| Description |
import { DaffMenuModule } from '@daffodil/design/menu'
@NgModule()
class DaffMenuModule {}
import { provideDaffMenuItemToken } from '@daffodil/design/menu'
function provideDaffMenuItemToken<R extends T = T>(klass: Type<R>): ExistingProvider
| Parameter | klass: Type<R> |
|---|---|
| Description |
import { DAFF_MENU_ITEM_TOKEN } from '@daffodil/design/menu'
const DAFF_MENU_ITEM_TOKEN: InjectionToken<any>
import { DaffMenuConfig } from '@daffodil/design/menu'
Configuration for a menu instance.
interface DaffMenuConfig {
menuId: string
xPosition: DaffMenuXPosition
yPosition: DaffMenuYPosition
}
menuId string |
|---|
A unique identifier for the menu instance. |
xPosition DaffMenuXPosition |
|---|
The horizontal alignment of the menu relative to its activator. Defaults to |
yPosition DaffMenuYPosition |
|---|
The vertical position of the menu relative to its activator. Defaults to |
import { DaffMenuXPosition } from '@daffodil/design/menu'
The horizontal alignment of the menu relative to its activator.
after lines the menu's left edge up with the activator's left edge.before lines the menu's right edge up with the activator's right edge.type DaffMenuXPosition = 'before' | 'after'
import { DaffMenuYPosition } from '@daffodil/design/menu'
The vertical position of the menu relative to its activator.
below drops the menu down from the activator's bottom edge.above raises the menu up from the activator's top edge.type DaffMenuYPosition = 'above' | 'below'
import { DaffMenuSlot } from '@daffodil/design/menu'
type DaffMenuSlot = TemplateRef<unknown> | DaffLazyComponent | Type<unknown>