### Install Semantic UI React with Yarn or NPM Source: https://github.com/semantic-org/semantic-ui-react/blob/master/docs/src/pages/Usage.mdx Installs the semantic-ui-react and semantic-ui-css packages using either yarn or npm. This is the recommended way to add Semantic UI React to your project. ```bash yarn add semantic-ui-react semantic-ui-css ## Or NPM ``` ```bash npm install semantic-ui-react semantic-ui-css ``` -------------------------------- ### Start Semantic UI React Project with Yarn Source: https://github.com/semantic-org/semantic-ui-react/blob/master/docs/src/pages/Theming.mdx This command initiates the development server for your Semantic UI React project. Ensure you have Yarn installed and the project dependencies are set up. ```bash yarn start ``` -------------------------------- ### Import Semantic UI CSS Source: https://github.com/semantic-org/semantic-ui-react/blob/master/docs/src/pages/Usage.mdx Imports the minified Semantic UI CSS file into your application's entry point. This ensures that the styles are applied globally. ```javascript import 'semantic-ui-css/semantic.min.css' ``` -------------------------------- ### Import Components for Layout Examples Source: https://github.com/semantic-org/semantic-ui-react/blob/master/docs/src/pages/Layouts.mdx Imports necessary components like Link from 'react-static' and Card, Header from 'semantic-ui-react' for creating layout examples. ```javascript import { Link } from 'react-static' import { Card, Header } from 'semantic-ui-react' ``` -------------------------------- ### Include Semantic UI via CDN Source: https://github.com/semantic-org/semantic-ui-react/blob/master/docs/src/pages/Usage.mdx Includes Semantic UI CSS and Semantic UI React JavaScript via CDN links in your HTML file. This method is suitable for projects without a bundler. ```html ``` -------------------------------- ### Display Layout Examples with Card.Group Source: https://github.com/semantic-org/semantic-ui-react/blob/master/docs/src/pages/Layouts.mdx Uses Header and Card.Group components to display a collection of layout examples, each linking to a specific layout page and providing a brief description and image. ```jsx
``` -------------------------------- ### Install Craco and Semantic UI LESS Dependencies Source: https://github.com/semantic-org/semantic-ui-react/blob/master/docs/src/pages/Theming.mdx Installs necessary development dependencies, including `@craco/craco` for customizing Create React App's build process and `@semantic-ui-react/craco-less` for LESS support, along with `semantic-ui-less`. ```bash npm install @craco/craco @semantic-ui-react/craco-less --save-dev npm install semantic-ui-less --save ``` ```bash yarn add @craco/craco @semantic-ui-react/craco-less --dev yarn add semantic-ui-less ``` -------------------------------- ### Modal Shorthand Examples Source: https://github.com/semantic-org/semantic-ui-react/blob/master/docs/src/pages/ShorthandProps.mdx Demonstrates different ways to provide shorthand values for the 'trigger' and 'content' props of a Modal component, including using React elements. ```jsx Show} content='Content' /> ``` ```jsx Show} content={{ content: 'Content' }} /> ``` ```jsx Show} content={
Content
} /> ``` -------------------------------- ### Replace Responsive component with @artsy/fresnel Source: https://github.com/semantic-org/semantic-ui-react/blob/master/docs/src/pages/MigrationGuideV2.mdx The 'Responsive' component has been removed. This example shows how to replace it using '@artsy/fresnel' for SSR-compatible responsive design. ```jsx import { createMedia } from "@artsy/fresnel"; import React from "react"; import { Segment } from "semantic-ui-react"; const AppMedia = createMedia({ breakpoints: { mobile: 320, tablet: 768, computer: 992, largeScreen: 1200, widescreen: 1920 } }); const mediaStyles = AppMedia.createMediaStyle(); const { Media, MediaContextProvider } = AppMedia; const App = () => ( <> Mobile ); ``` -------------------------------- ### Render a Semantic UI React Button without JSX Source: https://github.com/semantic-org/semantic-ui-react/blob/master/docs/src/pages/Usage.mdx Demonstrates how to render a Semantic UI React Button component using React.createElement and the global semanticUIReact object, without using JSX. This is useful for understanding the underlying structure. ```javascript const e = React.createElement const { Button } = semanticUIReact // ... Other JS code ... const domContainer = document.querySelector('#like_button_container') // 💡 This example is simplied to use React without JSX // https://reactjs.org/docs/react-without-jsx.html ReactDOM.render(e(Button, { primary: true }, 'Hello world!'), domContainer) ``` -------------------------------- ### Update Create React App Scripts Source: https://github.com/semantic-org/semantic-ui-react/blob/master/docs/src/pages/Theming.mdx Modifies the `scripts` section in `package.json` to use `craco` commands for starting, building, testing, and ejecting the Create React App, enabling custom build configurations. ```json { "scripts": { "start": "craco start", "build": "craco build", "test": "craco test", "eject": "craco eject" } } ``` -------------------------------- ### Semantic UI React pure-react-carousel Integration Source: https://github.com/semantic-org/semantic-ui-react/blob/master/docs/src/pages/Prototypes.mdx Demonstrates integrating Semantic UI React with pure-react-carousel for carousel functionality. Includes links to a CodeSandbox example and the source code on GitHub. ```jsx import { Button, Card, Header, Image } from 'semantic-ui-react' export const meta = { title: 'Prototypes', prevPage: { title: 'Layout examples', href: '/layouts' }, nextPage: { title: 'Migration Guide', href: '/migration-guide' }, }
pure-react-carousel Carousel examples powered by pure-react-carousel. ``` -------------------------------- ### Custom Icon Usage in Semantic UI React Source: https://github.com/semantic-org/semantic-ui-react/blob/master/README.md Demonstrates how to use custom icons in Semantic UI React by applying a custom class name to the Icon component. This allows for greater flexibility in styling and using unique icons. ```JavaScript import { Icon } from 'semantic-ui-react'; // Usage with a custom class ``` -------------------------------- ### Button with Custom Icon Element via Object Shorthand Source: https://github.com/semantic-org/semantic-ui-react/blob/master/docs/src/pages/ShorthandProps.mdx Provides an alternative and recommended way to render a custom HTML element as an icon by using an object with 'as' and 'className' properties in the shorthand. ```jsx