Skip to content

Style of the Custom Library not affecting in Webpart where using custom lbrary #9791

Open
@devanihiren

Description

@devanihiren

Target SharePoint environment

SharePoint Online

What SharePoint development model, framework, SDK or API is this about?

💥 SharePoint Framework

Developer environment

None

What browser(s) / client(s) have you tested

  • 💥 Internet Explorer
  • 💥 Microsoft Edge
  • 💥 Google Chrome
  • 💥 FireFox
  • 💥 Safari
  • mobile (iOS/iPadOS)
  • mobile (Android)
  • not applicable
  • other (enter in the "Additional environment details" area below)

Additional environment details

  • browser version
  • SPFx version
  • Node.js version
  • etc

Describe the bug / error

Want to use custom react library to the webpart
below is component of the react library

import * as React from 'react';
import './style.css';

interface Props {
  text: string
}

export const ExampleComponent = ({ text }: Props) => {
  return <div className="heading " >Example Component: {text}</div>
}

below is style.css file
.heading {
color: red !important;
}

above class not change color of the text
text color changes when i apply CSS file from the SPFx webpart or inline CSS only works.

How i can use library CSS class for the styling

Steps to reproduce

npx create-react-library
Cd
Npm pack
Install generated .tgz in SPFx Project
use like other library

Expected behavior

Want to affect style clas from the library stylle.css file

Metadata

Metadata

Assignees

Labels

Needs: Author FeedbackAwaiting response from the original poster of the issue. Marked as stale if no activity for 7 days.Needs: Triage 🔍Awaiting categorization and initial review.sharepoint-developer-supportsharepoint-developer-supporttype:questionQuestion... if answered, will be tagged as such.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions