Skip to content

Commit

Permalink
feat(Input): add disabled option to input
Browse files Browse the repository at this point in the history
  • Loading branch information
bramvanhoutte committed Nov 2, 2020
1 parent 8b3a58b commit 980a7fd
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
18 changes: 12 additions & 6 deletions src/components/Input/Input.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ A Input can be used to let the user insert text using key strokes. A crucial for
<Input name="firstname" />
</Playground>

### Input with error

<Playground>
<Input name="username" isInvalid />
</Playground>

### Disabled input

<Playground>
<Input name="username" value="fff" isDisabled />
</Playground>

### Listening for changes

<Playground>
Expand Down Expand Up @@ -55,12 +67,6 @@ A Input can be used to let the user insert text using key strokes. A crucial for
}
```

### Input with error

<Playground>
<Input name="username" isInvalid />
</Playground>

### Format a serial code

<Playground>
Expand Down
4 changes: 4 additions & 0 deletions src/components/Input/Input.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
box-shadow: 0 0 0 3px var(--color-focus);
}

.input:disabled {
color: var(--color-neutral-7);
}

.containsError {
border-color: var(--color-error);
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Input/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const Input = React.forwardRef<HTMLInputElement, Props>(
cssReset.ventura,
styles.input,
{
[styles.containsError]: Boolean(isInvalid),
[styles.containsError]: isInvalid,
},
className,
);
Expand Down

0 comments on commit 980a7fd

Please sign in to comment.