diff --git a/components/doc/dropdown/floatlabeldoc.js b/components/doc/dropdown/floatlabeldoc.js
index 7477afe488..23a7f78dfc 100644
--- a/components/doc/dropdown/floatlabeldoc.js
+++ b/components/doc/dropdown/floatlabeldoc.js
@@ -39,8 +39,8 @@ export default function FloatLabelDemo() {
return (
- setSelectedCity(e.value)} options={cities} optionLabel="name" className="w-full" />
-
+ setSelectedCity(e.value)} options={cities} optionLabel="name" className="w-full" />
+
)
@@ -69,8 +69,8 @@ export default function FloatLabelDemo() {
return (
- setSelectedCity(e.value)} options={cities} optionLabel="name" className="w-full" />
-
+ setSelectedCity(e.value)} options={cities} optionLabel="name" className="w-full" />
+
)
@@ -85,8 +85,10 @@ export default function FloatLabelDemo() {
- setSelectedCity(e.value)} options={cities} optionLabel="name" className="w-full" />
-
+ setSelectedCity(e.value)} options={cities} optionLabel="name" showClear className="w-full" />
+
diff --git a/components/doc/dropdown/labeldoc.js b/components/doc/dropdown/labeldoc.js
new file mode 100644
index 0000000000..d31da71ee1
--- /dev/null
+++ b/components/doc/dropdown/labeldoc.js
@@ -0,0 +1,97 @@
+import { DocSectionCode } from '@/components/doc/common/docsectioncode';
+import { DocSectionText } from '@/components/doc/common/docsectiontext';
+import { Dropdown } from '@/components/lib/dropdown/Dropdown';
+import { useState } from 'react';
+
+export function LabelDoc(props) {
+ const [selectedCity, setSelectedCity] = useState(null);
+ const cities = [
+ { name: 'New York', code: 'NY' },
+ { name: 'Rome', code: 'RM' },
+ { name: 'London', code: 'LDN' },
+ { name: 'Istanbul', code: 'IST' },
+ { name: 'Paris', code: 'PRS' }
+ ];
+
+ const code = {
+ basic: `
+
+
+ setSelectedCity(e.value)} options={cities} optionLabel="name" className="w-full" />
+
+ `,
+ javascript: `
+import React, { useState } from "react";
+import { Dropdown } from 'primereact/dropdown';
+
+export default function FloatLabelDemo() {
+ const [selectedCity, setSelectedCity] = useState(null);
+ const cities = [
+ { name: 'New York', code: 'NY' },
+ { name: 'Rome', code: 'RM' },
+ { name: 'London', code: 'LDN' },
+ { name: 'Istanbul', code: 'IST' },
+ { name: 'Paris', code: 'PRS' }
+ ];
+
+ return (
+
+
+
+ setSelectedCity(e.value)} options={cities} optionLabel="name" className="w-full" />
+
+
+ )
+}
+ `,
+ typescript: `
+import React, { useState } from "react";
+import { Dropdown, DropdownChangeEvent } from 'primereact/dropdown';
+import { div } from 'primereact/floatlabel';
+
+interface City {
+ name: string;
+ code: string;
+}
+
+export default function FloatLabelDemo() {
+ const [selectedCity, setSelectedCity] = useState(null);
+ const cities: City[] = [
+ { name: 'New York', code: 'NY' },
+ { name: 'Rome', code: 'RM' },
+ { name: 'London', code: 'LDN' },
+ { name: 'Istanbul', code: 'IST' },
+ { name: 'Paris', code: 'PRS' }
+ ];
+
+ return (
+
+
+
+ setSelectedCity(e.value)} options={cities} optionLabel="name" className="w-full" />
+
+
+ )
+}
+ `
+ };
+
+ return (
+ <>
+
+
+ Dropdown associated with a label using the aria-labelledby property and the label element's id attribute.
+
+
+
+
+
+ setSelectedCity(e.value)} options={cities} optionLabel="name" className="w-full" />
+
+
+
+ >
+ );
+}