Skip to content

Commit ad9a188

Browse files
authored
feat: add controls to toggle visibility (#344)
1 parent 25512eb commit ad9a188

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,12 @@ online example: https://input-number.vercel.app/
136136
<td>false</td>
137137
<td>Specifies that an InputNumber is read only </td>
138138
</tr>
139+
<tr>
140+
<td>controls</td>
141+
<td>Boolean</td>
142+
<td>true</td>
143+
<td>Whether to enable the control buttons</td>
144+
</tr>
139145
<tr>
140146
<td>name</td>
141147
<td>String</td>

src/InputNumber.tsx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export interface InputNumberProps<T extends ValueType = ValueType>
4242
max?: T;
4343
step?: ValueType;
4444
tabIndex?: number;
45+
controls?: boolean;
4546

4647
// Customize handler node
4748
upHandler?: React.ReactNode;
@@ -85,6 +86,7 @@ const InputNumber = React.forwardRef(
8586
upHandler,
8687
downHandler,
8788
keyboard,
89+
controls = true,
8890

8991
stringMode,
9092

@@ -502,14 +504,16 @@ const InputNumber = React.forwardRef(
502504
onCompositionStart={onCompositionStart}
503505
onCompositionEnd={onCompositionEnd}
504506
>
505-
<StepHandler
506-
prefixCls={prefixCls}
507-
upNode={upHandler}
508-
downNode={downHandler}
509-
upDisabled={upDisabled}
510-
downDisabled={downDisabled}
511-
onStep={onInternalStep}
512-
/>
507+
{controls && (
508+
<StepHandler
509+
prefixCls={prefixCls}
510+
upNode={upHandler}
511+
downNode={downHandler}
512+
upDisabled={upDisabled}
513+
downDisabled={downDisabled}
514+
onStep={onInternalStep}
515+
/>
516+
)}
513517
<div className={`${inputClassName}-wrap`}>
514518
<input
515519
autoComplete="off"

0 commit comments

Comments
 (0)