The New Way to Build with AI! Introducing ReUI — the developer platform for agentic UI with shadcn/ui
Browse ReUI Pro

Dismiss dropdown menu


Hi,

Is there a preimplemented way to close a dropdown menu on button click?

For example, on metronic react demo 2 notification logs, I'd like to close the menu when clicking on View all. What would be the best way to do this?

Best wishes,
Tamás


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (5)

 
Deleted comment
 
Deleted comment
 
Deleted comment
Deleted comment
 
Deleted comment
Deleted comment
 
Deleted comment

Hi happy,

Can you try to use the HTML attribute the view all links?

"data-kt-menu-dismiss='true'"

Regards



Hi Sean,

That worked wonderfully. Thanks!
Is there anywhere I can see all the available attributes for future reference?

Best,
Tamás



Hi,

At the moment we do not have a separate components doc for React version, but usage and attribute names should be the same as they are in the HTML version.

You can refer to our HTML version doc.



Thanks Lauris, got it.

Another question I had based on this, is how could one conditionally change some text based on the opened or closed state of an accordion elemenet?



You can add new styles to your component and then modify tag content depending on the accordion state.


.accordion-button.collapsed:before {
content: "more"
}

.accordion-button:before {
content: "less"
}


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
buy metronic keenthemes mega bundle

ReUI

Open-source React components, blocks and templates built on shadcn/ui and Tailwind CSS by Keenthemes.