Sol
Sol

Reputation: 3

can't disable Step(dynamically) with Ant Design

Step button is not being disabled. I want to disable it.

return Object.keys(props.quiz).length> 0 ? 
        <div>
            <Steps size="small" current={0} onChange={props.onChange}>
                    {
                        props.quiz.questions.map(item => 
                           <Step key={item.id} disabled/>
                    }
            </Steps>
       </div>

Result below:

enter image description here

Upvotes: 0

Views: 1924

Answers (2)

Damian Green
Damian Green

Reputation: 7495

the disabled attribute works fine on each Step

Here is an updated example with a dynamic disabled field in the array: https://codesandbox.io/s/naughty-hooks-70mpd?fontsize=14

Note you don't need to write disabled={true} as disabled is the shorthand. I presume the ** was your emphasis and not part of the code.

Upvotes: 1

Arthur Costa
Arthur Costa

Reputation: 1549

I've taken the Damian code and made it dynamic without any problems. You can check here: https://codesandbox.io/s/mutable-microservice-51dhh

Make sure that you're using the latest antd version and if you still have any difficulties try to reproduce the error in isolation (create a project in codesandbox to show the error).

Upvotes: 0

Related Questions