Options
All
  • Public
  • Public/Protected
  • All
Menu

Menu powered by Angular Material library.

Example of usage

import axios from 'axios';

export const component: DraymanComponent = async ({ forceUpdate }) => {
    let selectedImg;
    let selectedBreed;
    const dogBreeds = (await axios.get(`https://dog.ceo/api/breeds/list/all`)).data.message;

    return () => {
        return (
            <div>
                <drayman-menu
                    label={`${selectedBreed || 'Dog'}`}
                    items={
                        Object
                            .keys(dogBreeds)
                            .map(x => ({
                                label: x,
                                breed: x,
                                items: dogBreeds[x].map(xx => ({ label: xx, breed: `${x}/${xx}` })),
                            }))
                    }
                    onItemClick={async ({ item }) => {
                        selectedImg = (await axios.get(`https://dog.ceo/api/breed/${item.breed}/images/random`)).data.message;
                        selectedBreed = item.breed;
                        await forceUpdate();
                    }}
                />
                {selectedImg && <img src={selectedImg} style={{ width: '350px', height: 'auto' }} />}
            </div>
        );
    }
}

Hierarchy

Index

Properties

Optional buttonIconStyle

buttonIconStyle: any

Optional buttonRef

buttonRef: string

Reference to the button.

Optional buttonStyle

buttonStyle: any

Optional disabled

disabled: boolean

Wether button should be disabled.

Optional icon

icon: string

Name of the Material icon printed inside button.

Optional imgUrl

imgUrl: string

Image shown on hover.

items

items: DraymanMenuItem[]

Menu item list.

Optional label

label: string

Caption inside button. Button by default.

Optional onItemClick

onItemClick: ElementEvent<{ item: DraymanMenuItem }>

Executed when user clicks a menu item.

Optional popup

popup: { style?: any; text: string }

Type declaration

  • Optional style?: any
  • text: string

Optional ref

ref: string

Optional style

style: CSS

Optional tooltip

tooltip: string

Tooltip shown on hover.

Optional view

view: "basic" | "raised" | "flat" | "stroked" | "icon" | "fab" | "miniFab" | "unstyled"

Material style of the button. basic by default.