MCPcopy Create free account
hub / github.com/reactstrap/reactstrap / Example

Function Example

stories/examples/Form/LabelFloating.js:4–39  ·  view source on GitHub ↗
(props)

Source from the content-addressed store, hash-verified

2import { Button, Form, FormGroup, Label, Input } from 'reactstrap';
3
4function Example(props) {
5 return (
6 <>
7 <p>
8 Wrap a pair of <code>&lt;Input&gt;</code> and <code>&lt;Label&gt;</code>{' '}
9 components in <code>&lt;FormGroup floating&gt;</code> to enable floating
10 labels with Bootstrap’s textual form fields. A <code>placeholder</code>{' '}
11 is required on each <code>&lt;Input&gt;</code> as our method of CSS-only
12 floating labels uses the <code>:placeholder-shown</code> pseudo-element.
13 Also note that the <code>&lt;Input&gt;</code> must come first so we can
14 utilize a sibling selector (e.g., <code>~</code>).
15 </p>
16 <Form>
17 <FormGroup floating>
18 <Input
19 type="email"
20 name="email"
21 id="exampleEmail"
22 placeholder="Email"
23 />
24 <Label for="exampleEmail">Email</Label>
25 </FormGroup>{' '}
26 <FormGroup floating>
27 <Input
28 type="password"
29 name="password"
30 id="examplePassword"
31 placeholder="Password"
32 />
33 <Label for="examplePassword">Password</Label>
34 </FormGroup>{' '}
35 <Button>Submit</Button>
36 </Form>
37 </>
38 );
39}
40
41export default Example;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…