Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Semantic-UI UI class usage

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">
like image 955
MezzanineLearner Avatar asked Oct 15 '16 19:10

MezzanineLearner


People also ask

What is Semantic UI used for?

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.

Why use Semantic UI react?

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.

Which is better material UI or Semantic UI?

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.

Which is better bootstrap or Semantic UI?

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.


1 Answers

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 class item.

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.

like image 66
fstanis Avatar answered Oct 14 '22 01:10

fstanis