added controller display component for the controllers on a bin

This commit is contained in:
csawatzky 2026-03-06 15:12:25 -06:00
parent e4fe48025e
commit a9f5b9594b
3 changed files with 180 additions and 52 deletions

View file

@ -48,7 +48,11 @@ interface Props {
*
* @default undefined
*/
toggledButtons?: number[]
toggledButtons?: number[]
/**
* This can be used to set which button starts toggled by default, and from there it will be controlled internally, toggledButtons will override this
*/
defaultToggle?: number
/**
* Numerical value for the size of the text for buttons that dont use the icon
*/
@ -97,7 +101,7 @@ const useStyles = makeStyles((theme: Theme) => {
})
export default function ButtonGroup(props: Props){
const { buttons, toggle, toggledButtons, multiToggle, textSize, disableAll } = props
const { buttons, toggle, toggledButtons, defaultToggle, multiToggle, textSize, disableAll } = props
const classes = useStyles()
const [currentToggle, setCurrentToggle] = useState<number[]>([])
@ -107,6 +111,8 @@ export default function ButtonGroup(props: Props){
let toggled: number [] = [0]
if(toggledButtons){
toggled = toggledButtons
} else if(defaultToggle){
toggled = [defaultToggle]
}
setCurrentToggle(toggled)
}