更改Reaction-Bootstrap中的切换按钮颜色 [英] changing ToggleButton colors from react-bootstrap

查看:36
本文介绍了更改Reaction-Bootstrap中的切换按钮颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序上有一组ToggleButton,我想更改其背景颜色。目前,我的代码为所有按钮提供了<;。untoggled-Button>;的渐变,而未选中的按钮具有该渐变,并添加了一层蓝色薄膜。我有两个问题:我想要移除未切换按钮上的蓝色薄膜,以及我需要访问切换按钮来更改其样式。<;.toggled-Button>;只是一个目前不执行任何操作的占位符。

我想知道如何访问我的CSS中未选中的选中的版本的ToggleButton,以覆盖默认的引导样式!

JSX:

<ToggleButtonGroup className="view" type="radio" name="options" defaultValue={2}>
        <ToggleButton value={1} className="untoggled-button" > title</ToggleButton>
        <ToggleButton value={2} className="untoggled-button"> title</ToggleButton>
        <ToggleButton value={3} className="untoggled-button"> title</ToggleButton>
</ToggleButtonGroup>

css(这很不正确,但我希望能够同时设置未选中和选中按钮的样式):

.untoggled-button{
  background-image: some gradient !important;
}
.toggled-button {
  background-image: another gradient !important;
}

推荐答案

将背景颜色设置为透明并添加.active类似乎奏效了!

.untoggled-button{
  background-image: some gradient !important;
  background-color: transparent !important;
}
. untoggled-button.active {
  background-image: another gradient !important;
}

这篇关于更改Reaction-Bootstrap中的切换按钮颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆