question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Docs] How to create custom components?

See original GitHub issue

Hello, Semantic-UI community!

Question 1: How is the correct flow to extend the Semantic UI with a new component? The “Menu” and “Sidebar” components are not suitable for my case, so I tried to find a documentation about creating new components, but no lucky! If there is no docs for that, I suggest to create it. Or this is not the way you are working?

Question 2: As said, I am trying to create a custom “navbar” component that fits my case (there is no component with this name, so I used it).

  • I have a fresh custom installation, following the docs. Everything seems good.
  • First, I created a directory and file: /src/definitions/ezaca/navbar.less inspired by button.less
  • After that, I updated tasks/config/defaults.js to include my navbar

gulp build worked, but my component was not included.

  • Going to deeper levels, I found tasks/config/admin/realease.js with a list of components. Same result!
  • After a while, I found tasks/config/project/install.js with the list of components I selected in the custom installation, so I added { name: "navbar", checked: true }

gulp build worked, but my component is never included.

I have tested other places, but it seems I have changed the entire Semantic project, but my file keeps being cruelly ignored. After some hours I realized I’m stuck and on need of community help.

How should I include a custom component in Semantic UI?

Thanks, Eliakim.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:3
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

12reactions
ezacacommented, Jul 27, 2017

I have started a clean install. Now I added “bacon” in “elements”, because Semantic loves bacon, for sure! (And it will be side-by-side to “button” element).

  • Step 1: I ran gulp build to build the new install.
  • Step 2: added file src/definitions/elements/bacon.less (copied from button.less)
  • Step 3: added src/site/elements/bacon.overrides and bacon.variables (empty)
  • Step 4: added src/themes/default/elements/bacon.overrides and bacon.variables (empty)
  • Step 5: updated src/semantic.less to import bacon (line duplicated from button)
  • Step 6: updated src/theme.config to include bacon (line duplicated from button)
  • Step 7: updated /tasks/config/admin/release.js to include bacon
  • Step 8: updated /tasks/config/project/install.js to check bacon
  • Step 9: updated /tasks/config/defaults.js to include bacon
  • Step 10: ran gulp build again.
  • Step 11: checked dist/components/bacon.*

OK. That’s it! I think I have messed the things with the previous trial. It worked! This is the step-by-step to include CSS (Javascript requires one more step on globals to load). But steps 3 and 4 are optional. I don’t know if there are more optional steps, but it seems that everyone have their own jobs.

I hope this helps others with the same problem (and to build the docs)!

Thank you for the help, Banandrew!

(Powered by Google Translator 😄 )

1reaction
guylabbecommented, Mar 16, 2018

@ezaca Thank you for instructions, I adjusted files in the same way and my new component is created and CSS added to semantic.css.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Build a custom component - Google Web Designer Help
Build a custom component · 1. Define a custom element · 2. Create any additional JavaScript and CSS files necessary · 3. Transpile...
Read more >
Creating Custom Components - Docs - Snap Inc.
Once you have created a Custom Component, double-click on the Custom Component to edit it in Script Editor or to view more options...
Read more >
Using custom elements - Web Components | MDN
Customized built-in elements inherit from basic HTML elements. To create one of these, you have to specify which element they extend (as implied ......
Read more >
Develop custom components - Retool Docs
The Custom Component editor has 3 fields: Model, IFrame Code, and Hide when true. Model is where you define the model variable passed...
Read more >
Writing Custom Components | Prismatic Docs
Prismatic allows dev users to write custom API connectors and other components for their integrations. Learn more about creating custom components with ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found