diff --git a/components/doc/dropdown/templatedoc.js b/components/doc/dropdown/templatedoc.js index bd4528dd24..51b5cb4c25 100644 --- a/components/doc/dropdown/templatedoc.js +++ b/components/doc/dropdown/templatedoc.js @@ -1,5 +1,7 @@ import { useState } from 'react'; import { Dropdown } from '../../lib/dropdown/Dropdown'; +import { ChevronDownIcon } from '../../lib/icons/chevrondown'; +import { ChevronRightIcon } from '../../lib/icons/chevronright'; import { DocSectionCode } from '../common/docsectioncode'; import { DocSectionText } from '../common/docsectiontext'; @@ -57,11 +59,17 @@ export function TemplateDoc(props) { const code = { basic: ` setSelectedCountry(e.value)} options={countries} optionLabel="name" placeholder="Select a Country" - valueTemplate={selectedCountryTemplate} itemTemplate={countryOptionTemplate} className="w-full md:w-14rem" panelFooterTemplate={panelFooterTemplate} /> + valueTemplate={selectedCountryTemplate} itemTemplate={countryOptionTemplate} className="w-full md:w-14rem" panelFooterTemplate={panelFooterTemplate} + dropdownIcon={(opts) => { + return opts.iconProps['data-pr-overlay-visible'] ? : ; + }} +/> `, javascript: ` import React, { useState } from "react"; import { Dropdown } from 'primereact/dropdown'; +import { ChevronDownIcon } from 'primereact/icons/chevrondown'; +import { ChevronRightIcon } from 'primereact/icons/chevronright'; export default function TemplateDemo() { const [selectedCountry, setSelectedCountry] = useState(null); @@ -117,7 +125,10 @@ export default function TemplateDemo() { return (
setSelectedCountry(e.value)} options={countries} optionLabel="name" placeholder="Select a Country" - valueTemplate={selectedCountryTemplate} itemTemplate={countryOptionTemplate} className="w-full md:w-14rem" panelFooterTemplate={panelFooterTemplate} /> + valueTemplate={selectedCountryTemplate} itemTemplate={countryOptionTemplate} className="w-full md:w-14rem" panelFooterTemplate={panelFooterTemplate} + dropdownIcon={(opts) => { + return opts.iconProps['data-pr-overlay-visible'] ? : ; + }}/>
) } @@ -125,6 +136,8 @@ export default function TemplateDemo() { typescript: ` import React, { useState } from "react"; import { Dropdown, DropdownChangeEvent } from 'primereact/dropdown'; +import { CheckIcon } from 'primereact/icons/check'; +import { StarIcon } from 'primereact/icons/star'; interface Country { name: string; @@ -185,7 +198,10 @@ export default function TemplateDemo() { return (
setSelectedCountry(e.value)} options={countries} optionLabel="name" placeholder="Select a Country" - valueTemplate={selectedCountryTemplate} itemTemplate={countryOptionTemplate} className="w-full md:w-14rem" panelFooterTemplate={panelFooterTemplate} /> + valueTemplate={selectedCountryTemplate} itemTemplate={countryOptionTemplate} className="w-full md:w-14rem" panelFooterTemplate={panelFooterTemplate} + dropdownIcon={(opts) => { + return opts.iconProps['data-pr-overlay-visible'] ? : ; + }}/>/>
) } @@ -210,6 +226,9 @@ export default function TemplateDemo() { itemTemplate={countryOptionTemplate} panelFooterTemplate={panelFooterTemplate} className="w-full md:w-14rem" + dropdownIcon={(opts) => { + return opts.iconProps['data-pr-overlay-visible'] ? : ; + }} /> diff --git a/components/lib/dropdown/Dropdown.js b/components/lib/dropdown/Dropdown.js index 44570f8da3..145664df13 100644 --- a/components/lib/dropdown/Dropdown.js +++ b/components/lib/dropdown/Dropdown.js @@ -809,7 +809,8 @@ export const Dropdown = React.memo( const createDropdownIcon = () => { const dropdownIconProps = mergeProps( { - className: cx('dropdownIcon') + className: cx('dropdownIcon'), + 'data-pr-overlay-visible': overlayVisibleState }, ptm('dropdownIcon') );