Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ant design - control how to control "Segmented" transition background

Tags:

antd

I have the following segmented

<Segmented options={['Daily', 'Weekly', 'Monthly', 'Quarterly', 'Yearly']} />

I have to change the background colors:

.ant-segmented-item {
  background: #fff;
}

.ant-segmented-item-selected {
  background: red;
}

When I click on an item, I want the transition to be red. right no it is transparent and therefore I cant see the animation.
how is that possible?
Thanks
https://codesandbox.io/s/basic-antd-4-22-6-forked-qb3hqy?file=/index.css

like image 690
SexyMF Avatar asked Oct 31 '25 19:10

SexyMF


1 Answers

I believe the solution is to add the transition property.

.ant-segmented-item {
  transition: red 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
}
.ant-segmented-item-selected {
  background-color: red;
}

.ant-segmented-thumb {
  background-color: red;
}

Let me know if it works !


EDIT: Adding background in .ant-segmented-thumb seem to work.

https://codesandbox.io/s/basic-antd-4-22-6-forked-izquri?file=/index.css

like image 83
anurag-dhamala Avatar answered Nov 04 '25 02:11

anurag-dhamala



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!