Button
A button component that is fully customisable, that allows you to render Drupal buttons with custom type attributes.
$form['print_button'] = [
'#theme' => 'button',
'#text' => t('Custom Button'),
'#attributes' => [
'onclick' => 'print()',
'type' => 'button',
'class' => ['button', 'button--clean'],
],
];
Specifications
Machine name
button
Perks
Responsive
Accessible
Building blocks
HTML