Skip to content

Commit 0ae75ec

Browse files
fixed the copy snippet to make sure it shows up even below 768px
1 parent e32f239 commit 0ae75ec

File tree

5 files changed

+28
-23
lines changed

5 files changed

+28
-23
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
"analyze": "cross-env ANALYZE=true next build",
6060
"build": "next build",
6161
"dev": "next dev",
62-
"format": "prettier . --check",
62+
"format": "prettier . --write",
6363
"format:fix": "prettier . --write",
6464
"lint": "next lint",
6565
"lint:fix": "next lint --fix",

src/components/CodeArea.module.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@
4242
background: none;
4343
border: 1px solid transparent;
4444
color: currentColor;
45+
/* Keeps copy button visible on small screens */
46+
display: flex;
47+
align-items: center;
48+
justify-content: center;
4549
}
4650

4751
.active,

src/content/docs/useformstate/errormessage.mdx

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -155,15 +155,18 @@ export default function App() {
155155
```
156156

157157
```javascript copy sandbox="https://codesandbox.io/s/react-hook-form-v7-errormessage-multiple-error-messages-lnvkt"
158-
import { useForm } from "react-hook-form";
159-
import { ErrorMessage } from '@hookform/error-message';
160-
158+
import { useForm } from "react-hook-form"
159+
import { ErrorMessage } from "@hookform/error-message"
161160

162161
export default function App() {
163-
const { register, formState: { errors }, handleSubmit } = useForm({
164-
criteriaMode: "all"
165-
});
166-
const onSubmit = data => console.log(data);
162+
const {
163+
register,
164+
formState: { errors },
165+
handleSubmit,
166+
} = useForm({
167+
criteriaMode: "all",
168+
})
169+
const onSubmit = (data) => console.log(data)
167170

168171
return (
169172
<form onSubmit={handleSubmit(onSubmit)}>
@@ -172,12 +175,12 @@ export default function App() {
172175
required: "This is required.",
173176
pattern: {
174177
value: /d+/,
175-
message: "This input is number only."
178+
message: "This input is number only.",
176179
},
177180
maxLength: {
178181
value: 10,
179-
message: "This input exceed maxLength."
180-
}
182+
message: "This input exceed maxLength.",
183+
},
181184
})}
182185
/>
183186
<ErrorMessage
@@ -191,12 +194,10 @@ export default function App() {
191194
}
192195
/>
193196

194-
195197
<input type="submit" />
196198
</form>
197-
);
199+
)
198200
}
199-
200201
```
201202

202203
</TabGroup>

src/content/docs/usewatch/watch.mdx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,31 +20,31 @@ A React Hook Form component that provides the same functionality as `useWatch`,
2020
| `defaultValue` | <TypeText>unknown</TypeText> | default value for `useWatch` to return before the initial render.<br/><br/>**Note:** the first render will always return `defaultValue` when it's supplied. |
2121
| `disabled` | <TypeText>boolean = false</TypeText> | Option to disable the subscription. |
2222
| `exact` | <TypeText>boolean = false</TypeText> | This prop will enable an exact match for input name subscriptions. |
23-
| `render` | <TypeText>Function</TypeText> | Subscribes to specified form field(s) and re-renders its child function whenever the values change. This allows you to declaratively consume form values in JSX without manually wiring up state. |
23+
| `render` | <TypeText>Function</TypeText> | Subscribes to specified form field(s) and re-renders its child function whenever the values change. This allows you to declaratively consume form values in JSX without manually wiring up state. |
2424

2525
**Examples:**
2626

2727
---
2828

2929
```tsx copy sandbox=""
30-
import { useForm, Watch } from 'react-hook-form';
30+
import { useForm, Watch } from "react-hook-form"
3131

3232
const App = () => {
33-
const { register, control } = useForm();
33+
const { register, control } = useForm()
3434

3535
return (
3636
<div>
3737
<form>
38-
<input {...register('foo')} />
39-
<input {...register('bar')} />
38+
<input {...register("foo")} />
39+
<input {...register("bar")} />
4040
</form>
4141
{/* re-render only when value of `foo` changes */}
4242
<Watch
4343
control={control}
44-
names={['foo']}
44+
names={["foo"]}
4545
render={([foo]) => <span>{foo}</span>}
4646
/>
4747
</div>
48-
);
49-
};
48+
)
49+
}
5050
```

src/content/get-started.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ npm install react-hook-form
1414

1515
## Example
1616

17-
The following code excerpt demonstrates a basic usage example:
17+
The following code excerpt hello demonstrates a basic usage:
1818

1919
<TabGroup buttonLabels={["TS", "JS"]}>
2020

0 commit comments

Comments
 (0)