如何在菜单下拉反应-select中删除padding-top?
how to remove padding-top in menu drop-down react-select?
如何删除下拉菜单中的 padding-top react-select?
const customStyles = {
indicatorSeparator: styles => ({ ...styles, display: "none" }),
option: (provided, state) => ({
...provided,
fontSize: 16,
height:"40px",
paddingLeft: "11px",
":firstChild": {
margin: "10px",
padding: "10px",
borderRadius: "10px 10px 10px 10px"
}),
<Select
styles={customStyles}
defaultValue={[colourOptions[2], colourOptions[3]]}
isMulti
name="colors"
options={colourOptions}
className="basic-multi-select"
classNamePrefix="select"
/>
enter image description here
https://codesandbox.io/s/react-codesandboxer-example-90zz6
你应该根据react-select docs.
设置menuList
样式键的样式
menuList: (provided, state) => ({
...provided,
paddingTop: 0,
paddingBottom: 0,
}),
通过使用 {[firststyle,secandstyle]} 使用此使用多内联样式
并将第一种样式下方的第二种样式定义为
之后的形状
`const nopadinng={
paddingTop:0};`
and remove the classname
// remove the className
className="basic-multi-select"
const nopadinng={
paddingTop:0};
styles={[customStyles,nopadinng]}
菜单列表和 select 框之间的默认 margin-top
可以使用道具 styles
轻松删除,如下所示:
const styles = {
menu: base => ({
...base,
marginTop: 0
})
}
直播example here.
如何删除下拉菜单中的 padding-top react-select?
const customStyles = {
indicatorSeparator: styles => ({ ...styles, display: "none" }),
option: (provided, state) => ({
...provided,
fontSize: 16,
height:"40px",
paddingLeft: "11px",
":firstChild": {
margin: "10px",
padding: "10px",
borderRadius: "10px 10px 10px 10px"
}),
<Select
styles={customStyles}
defaultValue={[colourOptions[2], colourOptions[3]]}
isMulti
name="colors"
options={colourOptions}
className="basic-multi-select"
classNamePrefix="select"
/>
enter image description here https://codesandbox.io/s/react-codesandboxer-example-90zz6
你应该根据react-select docs.
设置menuList
样式键的样式
menuList: (provided, state) => ({
...provided,
paddingTop: 0,
paddingBottom: 0,
}),
通过使用 {[firststyle,secandstyle]} 使用此使用多内联样式 并将第一种样式下方的第二种样式定义为
之后的形状 `const nopadinng={
paddingTop:0};`
and remove the classname
// remove the className
className="basic-multi-select"
const nopadinng={
paddingTop:0};
styles={[customStyles,nopadinng]}
菜单列表和 select 框之间的默认 margin-top
可以使用道具 styles
轻松删除,如下所示:
const styles = {
menu: base => ({
...base,
marginTop: 0
})
}
直播example here.