What are the rules in using Semantic-ui's ui class? In the docs the ui class is not used consistently for example in defining menus
<div class="menu">
<div class="ui menu">
What is Semantic UI? Semantic UI is a front-end development framework similar to bootstrap designed for theming. It contains pre-built semantic components that helps create beautiful and responsive layouts using human-friendly HTML.
Semantic UI React provides React components while Semantic UI provides themes as CSS stylesheets. Install the React components and choose a theme that suits your needs.
According to the StackShare community, Material-UI has a broader approval, being mentioned in 67 company stacks & 77 developers stacks; compared to Semantic UI, which is listed in 77 company stacks and 50 developer stacks.
Additional Customization: Undoubtedly, Bootstrap offers ample customization options. But, Semantic UI has got an edge over Bootstrap with extra elements that offer far more options to customize. Semantic Solutions: Beginners can get along well with Semantic UI as it uses semantic class names for styling the elements.
This is covered in the Glossary part of the documentation:
ui
is a special class name used to distinguish parts of components from components.For example, a list will receive the class
ui list
because it has a corresponding definition, however a list item, will receive just the classitem
.The ui class name helps encapsulate CSS rules by making sure all 'parts of a component' are defined in context to a 'whole' component.
It also helps make scanning unknown code simpler. If you see
ui
you know you are looking at a component.
The menu is a good demonstration of this (simplified example from documentation):
<div class="ui text menu">
<div class="ui dropdown item">
Applying
<i class="dropdown icon"></i>
<div class="menu">
<div class="item">Applications</div>
<div class="item">International Students</div>
<div class="item">Scholarships</div>
</div>
</div>
</div>
The outer menu is an actual UI component, and thus has both ui
and menu
. However, the inner menu is actually part of another component, the dropdown, and thus doesn't have the ui
class.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With