Search code examples
htmlwidgetsemantic-markup

Semantic HTML element representing an UI widget


Is there an element in HTML that represents an UI widget?

I wonder if any of the semantic HTML elements is designed for widgets like draggable clocks, weather forecasts or address book contacts?

I’m not sure if <aside> makes sense for an interactive UI element and whether <dialog> is intended for anything other than a modal dialog or if I should stick to <section> or even <div>.


Solution

  • Yes, there is: By definition, the <article> element is designed for, among other things, representing an interface widget.

    The W3C specifies:

    The article element represents a complete, or self-contained, composition in a document, page, application, or site and that is, in principle, independently distributable or reusable, e.g. in syndication. This could be ( … ) an interactive widget or gadget, or any other independent item of content.

    That fits well with the Wikipedia definition of “widget”:

    • a generic type of software application comprising portable code intended for one or more different software platforms
    • a reusable element of a graphical user interface