-
Iβm trying to implement custom component with streamlit via streamlit template.
-
Iβm trying to simply wrap existing multi select react component.
(i.e. react-multi-select-component - npm) -
But when I tried, the output dropdown items is not visible(cropped, I think)
-
The code
import {
Streamlit,
StreamlitComponentBase,
withStreamlitConnection,
} from "streamlit-component-lib"
import React, { ReactNode } from "react"
import MultiSelect from "react-multi-select-component";
interface State {
isFocused: boolean;
selected: any;
}
class MultiSelectCheckbox extends StreamlitComponentBase<State> {
public state = {
selected: [
{ label: "Grapes π", value: "grapes" },
{ label: "Mango π₯", value: "mango" }],
isFocused: false }
public render = (): ReactNode => {
const options = [
{ label: "Grapes π", value: "grapes" },
{ label: "Mango π₯", value: "mango" },
{ label: "Strawberry π", value: "strawberry", disabled: true },
{ label: "Watermelon π", value: "watermelon" },
{ label: "Pear π", value: "pear" },
{ label: "Apple π", value: "apple" },
{ label: "Tangerine π", value: "tangerine" },
{ label: "Pineapple π", value: "pineapple" },
{ label: "Peach π", value: "peach" },
];
return (
<div>
<MultiSelect
options={options}
value={this.state.selected}
// onChange={(d: string[]) => {this.setState({selected: d});}}
labelledBy="Select"
/>
</div>
)
}
}
export default withStreamlitConnection(MultiSelectCheckbox)
-
Result output
- before click
- after click on down arrow(v)
- before click
-
Iβm new to React and I couldnβt figure out how to handle this problem. Can anyone help with this problem?