Skip to content

Commit 4bbdffb

Browse files
Merge pull request #8189 from primefaces/v11-iconfield
V11 iconfield
2 parents 630a993 + 92093dc commit 4bbdffb

27 files changed

Lines changed: 553 additions & 0 deletions
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { IconField } from 'primereact/iconfield';
2+
import { InputText } from 'primereact/inputtext';
3+
4+
export default function BasicDemo() {
5+
return (
6+
<div className="card flex flex-wrap justify-center gap-4">
7+
<IconField>
8+
<IconField.Icon>
9+
<i className="pi pi-search" />
10+
</IconField.Icon>
11+
<InputText placeholder="Search" />
12+
</IconField>
13+
<IconField>
14+
<InputText variant="filled" />
15+
<IconField.Icon>
16+
<i className="pi pi-spin pi-spinner" />
17+
</IconField.Icon>
18+
</IconField>
19+
</div>
20+
);
21+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { IconField } from 'primereact/iconfield';
2+
import { InputText } from 'primereact/inputtext';
3+
import { Label } from 'primereact/label';
4+
import * as React from 'react';
5+
6+
export default function FloatLabelDemo() {
7+
const [value1, setValue1] = React.useState('');
8+
const [value2, setValue2] = React.useState('');
9+
const [value3, setValue3] = React.useState('');
10+
11+
return (
12+
<div className="card flex flex-wrap justify-center items-end gap-4">
13+
<Label.Float>
14+
<IconField>
15+
<IconField.Icon>
16+
<i className="pi pi-search" />
17+
</IconField.Icon>
18+
<InputText value={value1} onInput={(e: React.FormEvent<HTMLInputElement>) => setValue1(e.currentTarget.value)} id="over_label" autoComplete="off" />
19+
</IconField>
20+
<Label htmlFor="over_label">Over Label</Label>
21+
</Label.Float>
22+
23+
<Label.Float variant="in">
24+
<IconField>
25+
<IconField.Icon>
26+
<i className="pi pi-search" />
27+
</IconField.Icon>
28+
<InputText value={value2} onInput={(e: React.FormEvent<HTMLInputElement>) => setValue2(e.currentTarget.value)} id="in_label" autoComplete="off" variant="filled" />
29+
</IconField>
30+
<Label htmlFor="in_label">In Label</Label>
31+
</Label.Float>
32+
33+
<Label.Float variant="on">
34+
<IconField>
35+
<IconField.Icon>
36+
<i className="pi pi-search" />
37+
</IconField.Icon>
38+
<InputText value={value3} onInput={(e: React.FormEvent<HTMLInputElement>) => setValue3(e.currentTarget.value)} id="on_label" autoComplete="off" />
39+
</IconField>
40+
<Label htmlFor="on_label">On Label</Label>
41+
</Label.Float>
42+
</div>
43+
);
44+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { IconField } from 'primereact/iconfield';
2+
import { InputText } from 'primereact/inputtext';
3+
4+
export default function IconFieldPTDemo() {
5+
return (
6+
<IconField>
7+
<IconField.Icon>
8+
<i className="pi pi-search" />
9+
</IconField.Icon>
10+
<InputText placeholder="Search" />
11+
</IconField>
12+
);
13+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { IconField } from 'primereact/iconfield';
2+
import { InputText } from 'primereact/inputtext';
3+
import { Label } from 'primereact/label';
4+
5+
export default function IftaLabelDemo() {
6+
return (
7+
<div className="card flex justify-center">
8+
<Label.Ifta>
9+
<IconField>
10+
<IconField.Icon>
11+
<i className="pi pi-user" />
12+
</IconField.Icon>
13+
<InputText id="username" autoComplete="off" variant="filled" />
14+
</IconField>
15+
<Label htmlFor="username">Username</Label>
16+
</Label.Ifta>
17+
</div>
18+
);
19+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { IconField } from 'primereact/iconfield';
2+
import { InputText } from 'primereact/inputtext';
3+
4+
export default function SizesDemo() {
5+
return (
6+
<div className="card flex flex-col items-center gap-4">
7+
<IconField>
8+
<IconField.Icon>
9+
<i className="pi pi-search" />
10+
</IconField.Icon>
11+
<InputText placeholder="Small" size="small" />
12+
</IconField>
13+
14+
<IconField>
15+
<InputText placeholder="Normal" />
16+
<IconField.Icon>
17+
<i className="pi pi-user" />
18+
</IconField.Icon>
19+
</IconField>
20+
21+
<IconField>
22+
<IconField.Icon>
23+
<i className="pi pi-lock" />
24+
</IconField.Icon>
25+
<InputText placeholder="Large" size="large" />
26+
<IconField.Icon>
27+
<i className="pi pi-spin pi-spinner" />
28+
</IconField.Icon>
29+
</IconField>
30+
</div>
31+
);
32+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
title: IconField API
3+
description: API documentation for IconField component
4+
component: iconfield
5+
---
6+
7+
## IconField
8+
9+
### Props
10+
11+
<DocTable name="IconField" category="api" type="props" />
12+
13+
### Interfaces
14+
15+
<DocTable name="IconField" category="api" type="interfaces" />
16+
17+
### Types
18+
19+
<DocTable name="IconField" category="api" type="types" />
20+
21+
## InputIcon
22+
23+
### Props
24+
25+
<DocTable name="InputIcon" category="api" type="props" />
26+
27+
### Exposes
28+
29+
<DocTable name="InputIcon" category="api" type="exposes" />
30+
31+
### Interfaces
32+
33+
<DocTable name="InputIcon" category="api" type="interfaces" />
34+
35+
### Types
36+
37+
<DocTable name="InputIcon" category="api" type="types" />
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
title: IconField
3+
description: IconField wraps an input and an icon.
4+
component: iconfield
5+
---
6+
7+
## Usage
8+
9+
```tsx
10+
import { IconField } from 'primereact/iconfield';
11+
```
12+
13+
```tsx
14+
<IconField>
15+
<IconField.Icon />
16+
<InputText />
17+
</IconField>
18+
```
19+
20+
## Examples
21+
22+
### Basic
23+
24+
`IconField` wraps the `IconField.Icon` and the input field component.
25+
26+
<DocDemoViewer name="iconfield:basic-demo" />
27+
28+
### Float Label
29+
30+
FloatLabel visually integrates a label with its form element. Visit [FloatLabel](/docs/components/floatlabel) documentation for more information.
31+
32+
<DocDemoViewer name="iconfield:float-label-demo" />
33+
34+
### Ifta Label
35+
36+
IftaLabel is used to create infield top aligned labels. Visit [IftaLabel](/docs/components/iftalabel) documentation for more information.
37+
38+
<DocDemoViewer name="iconfield:ifta-label-demo" />
39+
40+
### Sizes
41+
42+
IconField is compatible with the size setting of the input field.
43+
44+
<DocDemoViewer name="iconfield:sizes-demo" />
45+
46+
## Accessibility
47+
48+
### Screen Reader
49+
50+
IconField and InputIcon do not require any roles and attributes.
51+
52+
### Keyboard Support
53+
54+
Components does not include any interactive elements.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
title: IconField Pass Through
3+
description: Pass Through documentation for IconField component
4+
component: iconfield
5+
---
6+
7+
## Viewer
8+
9+
Some sections may not be visible due to the availability of the particular feature.
10+
11+
<DocPTViewer name="iconfield-pt" components={['IconField', 'InputIcon']} />
12+
13+
## IconField PT Options
14+
15+
<DocTable name="IconField" category="pt" />
16+
17+
## InputIcon PT Options
18+
19+
<DocTable name="InputIcon" category="pt" />
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
title: IconField Theming
3+
description: Theming documentation for IconField component
4+
component: iconfield
5+
---
6+
7+
## Styled
8+
9+
### CSS Classes
10+
11+
List of class names used in the styled mode.
12+
13+
<DocTable name="IconField" category="style" />
14+
15+
### Design Tokens
16+
17+
List of design tokens.
18+
19+
<DocTable name="IconField" category="token" />
20+
21+
## Unstyled
22+
23+
Theming is implemented with the pass through properties in unstyled mode.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from './useIconField';
2+
export * from './useIconField.props';

0 commit comments

Comments
 (0)