mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 20:33:32 +08:00

* docs(all): possible values are extracted by stencil * add defaults * remove all hardcoded defaults * update stencil
63 lines
1.6 KiB
TypeScript
63 lines
1.6 KiB
TypeScript
import { Component, ComponentInterface, Prop } from '@stencil/core';
|
|
|
|
import { Color, Config, Mode } from '../../interface';
|
|
|
|
@Component({
|
|
tag: 'ion-menu-button',
|
|
styleUrls: {
|
|
ios: 'menu-button.ios.scss',
|
|
md: 'menu-button.md.scss'
|
|
},
|
|
shadow: true
|
|
})
|
|
export class MenuButton implements ComponentInterface {
|
|
|
|
@Prop({ context: 'config' }) config!: Config;
|
|
|
|
/**
|
|
* The color to use from your application's color palette.
|
|
* Default options are: `"primary"`, `"secondary"`, `"tertiary"`, `"success"`, `"warning"`, `"danger"`, `"light"`, `"medium"`, and `"dark"`.
|
|
* For more information on colors, see [theming](/docs/theming/basics).
|
|
*/
|
|
@Prop() color?: Color;
|
|
|
|
/**
|
|
* The mode determines which platform styles to use.
|
|
*/
|
|
@Prop() mode!: Mode;
|
|
|
|
/**
|
|
* Optional property that maps to a Menu's `menuId` prop. Can also be `start` or `end` for the menu side. This is used to find the correct menu to toggle
|
|
*/
|
|
@Prop() menu?: string;
|
|
|
|
/**
|
|
* Automatically hides the menu button when the corresponding menu is not active
|
|
*/
|
|
@Prop() autoHide = true;
|
|
|
|
hostData() {
|
|
return {
|
|
'ion-activatable': true,
|
|
class: {
|
|
// ion-buttons target .button
|
|
'button': true
|
|
}
|
|
};
|
|
}
|
|
|
|
render() {
|
|
const menuIcon = this.config.get('menuIcon', 'menu');
|
|
return (
|
|
<ion-menu-toggle menu={this.menu} autoHide={this.autoHide}>
|
|
<button type="button">
|
|
<slot>
|
|
<ion-icon icon={menuIcon} mode={this.mode} color={this.color} lazy={false} />
|
|
</slot>
|
|
{this.mode === 'md' && <ion-ripple-effect></ion-ripple-effect>}
|
|
</button>
|
|
</ion-menu-toggle>
|
|
);
|
|
}
|
|
}
|