JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="https://yastatic.net/bem-components/latest/desktop/bem-components.css">
<script src="https://yastatic.net/bem-components/latest/desktop/bem-components.js+bh.js"></script>
<div class="container"></div>
JavaScript
modules.require(['i-bem__dom', 'BEMHTML', 'jquery'], (BEMDOM, BEMHTML, $) => {
const $container = $('.container');
const html = BEMHTML.apply({
block : 'select',
mods : { mode : 'radio', theme : 'islands', size : 'm' },
name : 'types',
val : [1],
text : 'Тип',
options : [
{ val : 1, text : 'Тип 1' },
{ val : 2, text : 'Тип 2' },
{ val : 3, text : 'Тип 3' }
]
});
BEMDOM.append($container, html);
$container.bem('select').on('change', (event) => {
// getVal метод BEM Select
const value = event.target.getVal();
console.log(value);
});
});