MCPcopy
hub / github.com/plotly/dash / Option

Function Option

components/dash-core-components/src/utils/optionRendering.tsx:70–139  ·  view source on GitHub ↗
({
    option,
    isSelected,
    onChange,
    optionClassName,
    optionStyle,
    inputType = 'checkbox',
    inputClassName,
    inputStyle,
    labelClassName,
    labelStyle,
    index,
    id,
})

Source from the content-addressed store, hash-verified

68}
69
70export const Option: React.FC<OptionProps> = ({
71 option,
72 isSelected,
73 onChange,
74 optionClassName,
75 optionStyle,
76 inputType = 'checkbox',
77 inputClassName,
78 inputStyle,
79 labelClassName,
80 labelStyle,
81 index,
82 id,
83}) => {
84 const classNames = [
85 'dash-options-list-option',
86 isSelected ? 'selected' : '',
87 optionClassName,
88 ].filter(Boolean);
89
90 const inputClassNames = [
91 'dash-options-list-option-checkbox',
92 inputClassName,
93 ].filter(Boolean);
94
95 const labelClassNames = [
96 'dash-options-list-option-text',
97 labelClassName,
98 ].filter(Boolean);
99
100 return (
101 <label
102 className={classNames.join(' ')}
103 role="option"
104 aria-selected={isSelected}
105 style={optionStyle}
106 data-option-index={index}
107 >
108 <span className="dash-options-list-option-wrapper">
109 <input
110 type={inputType}
111 checked={isSelected}
112 name={id}
113 value={
114 typeof option.value === 'boolean'
115 ? `${option.value}`
116 : option.value
117 }
118 disabled={!!option.disabled}
119 onChange={() => onChange(option)}
120 onKeyUp={e => {
121 if (e.key === 'Enter') {
122 onChange(option);
123 }
124 }}
125 readOnly
126 className={inputClassNames.join(' ')}
127 style={inputStyle}

Callers

nothing calls this directly

Calls 1

filterMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…