Semantic UI Vue
semantic-ui-vue is a Vue.js integration of the Semantic UI CSS framework, aiming to provide a component library with an API highly inspired by Semantic UI React. The latest stable version, 0.11.0, was released in June 2020. The project's release cadence appears to be stalled, with the last significant activity occurring over four years ago. A key differentiator is its goal of mirroring the Semantic UI React API, making it potentially familiar to developers transitioning between React and Vue. However, the project is explicitly seeking maintainers and states it is 'under heavy development' despite the lack of recent updates, which is a significant point of concern for stability and ongoing support. Users must manually include Semantic UI CSS stylesheets as a separate step for the components to render correctly.
Common errors
-
Unknown custom element: `<sui-button>` - did you register the component correctly?
cause The Semantic UI Vue plugin (`SuiVue`) has not been registered globally with Vue.fixEnsure `Vue.use(SuiVue);` is called in your main application entry file (e.g., `main.js` or `index.js`) before your Vue app is instantiated. -
TypeError: Cannot read properties of undefined (reading 'install')
-
Vue.use() expects a plugin to be a function or an object with an 'install' method.
cause The `SuiVue` object was not correctly imported or is undefined, often due to incorrect `require()` or `import` syntax, or the script being loaded too late.fixVerify the import statement: `import SuiVue from 'semantic-ui-vue';` for ESM or `const SuiVue = require('semantic-ui-vue');` for CommonJS. If using script tags, ensure `semantic-ui-vue.min.js` is loaded after `vue.min.js`. -
Components render without any styling; appear as basic HTML elements.
cause The Semantic UI CSS stylesheet is missing from the project.fixAdd the Semantic UI CSS to your project. This can be done via a CDN link in your `index.html` (`<link rel='stylesheet' href='//cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.css' />`) or by installing `semantic-ui-css` via npm and importing it into your build.
Warnings
- breaking The `semantic-ui-vue` project appears to be abandoned or in a severely unmaintained state. The last release was in June 2020, and the `README` explicitly states 'Looking for maintainers!'. This indicates a high risk of no further updates, bug fixes, or compatibility improvements, especially for newer Vue versions.
- gotcha Semantic UI Vue components require the Semantic UI CSS stylesheet to be included separately. Without the `semantic.min.css` file (either via CDN or the `semantic-ui-css` npm package), components will render unstyled, appearing as plain HTML elements.
- breaking This library is primarily built for Vue 2. It is highly unlikely to be compatible with Vue 3 due to breaking changes in Vue's API, component registration, and reactivity system. Attempting to use `semantic-ui-vue` with Vue 3 will likely result in runtime errors.
Install
-
npm install semantic-ui-vue -
yarn add semantic-ui-vue -
pnpm add semantic-ui-vue
Imports
- SuiVue
import { SuiVue } from 'semantic-ui-vue';import SuiVue from 'semantic-ui-vue';
- SuiVue
const SuiVue = require('semantic-ui-vue'); - SuiButton
import { SuiButton } from 'semantic-ui-vue';
Quickstart
import Vue from 'vue';
import SuiVue from 'semantic-ui-vue';
// Ensure Semantic UI CSS is loaded. For example, by importing 'semantic-ui-css/semantic.min.css'
// or including a CDN link in your index.html: <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.css" />
Vue.use(SuiVue);
new Vue({
el: '#app',
data: {
message: 'Hello from Semantic UI Vue!'
},
template: `
<div class="ui container" style="margin-top: 20px;">
<sui-header as="h2">
<sui-icon name="settings" />
<sui-header-content>
My Application
<sui-header-subheader>Manage your preferences</sui-header-subheader>
</sui-header-content>
</sui-header>
<sui-button primary @click="message = 'Button Clicked!'">
Click Me
</sui-button>
<sui-button secondary>
Secondary
</sui-button>
<p style="margin-top: 15px;">{{ message }}</p>
</div>
`
});