Semantic-UI Image properties not working with semantic-ui-react
Asked Answered
P

2

2

I´m trying to use the official semantic-ui-react for the first time with React. I´ve built a brand new react application:

$ create-react-app test

And I then tried to add the same react image as follows in App.js:

import React, { Component } from 'react';
import logo from './logo.svg';
import { Image } from 'semantic-ui-react';

import './App.css';


class App extends Component {
  render() {
    return (
      <div className="App">
        <div className="App-header">
          <img src={logo} className="App-logo" alt="logo" />
          <h2>Welcome to React</h2>
        </div>
        <p className="App-intro">
          To get started, edit <code>src/App.js</code> and save to reload.
        </p>

        <div className="ui container">
          <h1>Hello World</h1>
          <Image src={logo} avatar/>
          <Image src={logo} size='mini'/>
        </div>

      </div>
    );
  }
}

export default App;

The result shows me 2 big react {logo} images, not mini or avatar styled:

enter image description here

Ideas of what I´m missing here ?

Portuguese answered 17/6, 2017 at 21:50 Comment(1)
I have tried to re-implement your example code but I'm getting the same render as you. I'm as stuck as you are, but looking into it.Doggett
A
5

Semantic UI React requires a Semantic UI' CSS, you forgot to setup it, here is instuctions. We will also add an example setup with CRA soon.

Aenneea answered 18/6, 2017 at 7:30 Comment(0)
P
0

You might have found your answer already, but not seeing it here, so adding solution for the same error I got while using Image component with svg icon

import { Image } from 'semantic-ui-react';
import { ReactComponent as Logo } from './logo.svg';

<div className="ui container">
    <h1>Hello World</h1>
    <Image as={Logo} title="logo" avatar />
</div>

Hope this helps some one!

Pronoun answered 26/8, 2022 at 5:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.