const select = document.querySelector('.single-option-selector')
const options = Array.from(select.children)
const buttonGroup = document.querySelector('.button-group')
// Create buttons for each option with corresponding values
// and text content
options.forEach(({ value, textContent }) => {
const button = document.createElement('button')
button.textContent = textContent
button.value = value
button.type = 'button'
buttonGroup.appendChild(button)
})
// When clicking a button, set the value of the select
// to the value of the button
buttonGroup.addEventListener('click', ({ target }) => {
const { value, type } = target
if (type === 'button') {
select.value = value
}
})
Although I guess a radio group would be a better choice here to reflect the select behaviour (you might also hide the actual radio and only style their labels like buttons)… so you can also style the currently :checked one with CSS.