PHP
use yh\mdc\components\Button;
use yh\mdc\components\Menu;
echo Menu::one([
'id' => 'menu1',
'items' => [
[
'text' => 'Menu1',
'separator' => true
],
[
'text' => 'Menu2',
'href' => '#',
'options' => [
'data' => ['method' => 'post']
]
],
]
])
->render();
echo Button::one('button1')->setId('button1')->render();
JavaScript
app.controls.add('menu', 'menu', []);
app.controls.add('button1', 'button', []);
app.controls.item('button1').listen('click', () => {
app.controls.item('menu1').open = true;
});
Samples