React
Sharepoint React SPFX issue scss missing
On 24/09/2025
in my react code below i have and an error : Cannot find module '../View.module.scss' or its corresponding type declarations.
import styles from './View.module.scss';
To solve it verify this fils exists
View.module.scss.ts was missing with code below, so i add it
require("./View.module.css");
const styles = {
genericView: 'genericView_c46baf68',
countryview: 'countryview_c46baf68',
tableContainer: 'tableContainer_c46baf68',
filterLabel: 'filterLabel_c46baf68',
cell: 'cell_c46baf68',
buttonCell: 'buttonCell_c46baf68',
clearButton: 'clearButton_c46baf68',
detailsList: 'detailsList_c46baf68',
detailsListValue: 'detailsListValue_c46baf68',
iconGreen: 'iconGreen_c46baf68',
iconRed: 'iconRed_c46baf68',
field: 'field_c46baf68',
fieldLabel: 'fieldLabel_c46baf68',
fieldLabelContainer: 'fieldLabelContainer_c46baf68',
fieldValue: 'fieldValue_c46baf68',
fieldLower: 'fieldLower_c46baf68',
spinnerContainer: 'spinnerContainer_c46baf68',
noItems: 'noItems_c46baf68',
callout: 'callout_c46baf68',
viewDescription: 'viewDescription_c46baf68',
emptyItem: 'emptyItem_c46baf68',
statusActive: 'statusActive_c46baf68',
statusInactive: 'statusInactive_c46baf68',
statusDissolved: 'statusDissolved_c46baf68'
};
export default styles;
Fluent Ui Componants List
On 25/02/2025
Fluent UI Components and Properties
Button
| Property | Description |
|---|---|
| text | The text to display on the button. |
| iconProps | Properties to pass to the icon. |
| onClick | Callback for when the button is clicked. |
| disabled | Whether the button is disabled. |
TextField
| Property | Description |
|---|---|
| label | The label for the text field. |
| value | The value of the text field. |
| onChange | Callback for when the value changes. |
| placeholder | Placeholder text for the text field. |
| disabled | Whether the text field is disabled. |
Dropdown
| Property | Description |
|---|---|
| label | The label for the dropdown. |
| options | Array of options to display in the dropdown. |
| selectedKey | The key of the selected option. |
| onChange | Callback for when the selected option changes. |
| placeholder | Placeholder text for the dropdown. |
| disabled | Whether the dropdown is disabled. |
Checkbox
| Property | Description |
|---|---|
| label | The label for the checkbox. |
| checked | Whether the checkbox is checked. |
| onChange | Callback for when the checkbox is toggled. |
| disabled | Whether the checkbox is disabled. |
Toggle
| Property | Description |
|---|---|
| label | The label for the toggle. |
| checked | Whether the toggle is checked. |
| onChange | Callback for when the toggle is toggled. |
| disabled | Whether the toggle is disabled. |
Modal
| Property | Description |
|---|---|
| isOpen | Whether the modal is open. |
| onDismiss | Callback for when the modal is dismissed. |
| isBlocking | Whether the modal is blocking. |
| containerClassName | Custom class name for the modal container. |
Panel
| Property | Description |
|---|---|
| isOpen | Whether the panel is open. |
| onDismiss | Callback for when the panel is dismissed. |
| headerText | The text to display in the panel header. |
| closeButtonAriaLabel | The ARIA label for the close button. |
DetailsList
| Property | Description |
|---|---|
| items | Array of items to display in the list. |
| columns | Array of column definitions. |
| onItemInvoked | Callback for when an item is invoked. |
| selection | Selection object to manage selected items. |
Icon
| Property | Description |
|---|---|
| iconName | The name of the icon to display. |
| style | Custom styles for the icon. |
| className | Custom class name for the icon. |
Spinner
| Property | Description |
|---|---|
| label | The label for the spinner. |
| size | The size of the spinner (e.g., 'small', 'medium', 'large'). |
| ariaLive | The ARIA live region attribute. |
MessageBar
| Property | Description |
|---|---|
| messageBarType | The type of the message bar (e.g., 'info', 'success', 'warning', 'error'). |
| isMultiline | Whether the message bar should display multiple lines. |
| onDismiss | Callback for when the message bar is dismissed. |
| dismissButtonAriaLabel | The ARIA label for the dismiss button. |
How to resolve the 5000 item limit
On 24/01/2022
var firstItems = listLocation.web.getList(listLocation.listUri).items.select('ID').top(1).orderBy('Id').get();
var lastItems = listLocation.web.getList(listLocation.listUri).items.select('ID').top(1).orderBy('Id', false).get();
const allMySites = [];
if (firstItems.length === 1 && lastItems.length === 1) {
const firstId: number = firstItems[0].ID;
const lastId: number = lastItems[0].ID;
let startId = firstId;
let endId = firstId + 5000;
do {
let mySites: ISite[] = await listLocation.web.getList(listLocation.listUri).items
.select('ID', 'Title', 'Url')
.filter(`Id ge ${startId} and Id lt ${endId} and ProprietairesPeople/Id eq ${userId}`)
.expand('ProprietairesPeople')
.orderBy('Title')
.top(5000)
.getAll();
allMySites.push(...mySites);
startId = startId + 5000;
endId = endId + 5000;
}
while (endId < lastId);
}
return allMySites;
SPFX React Tips
On 02/09/2020
Override native css
:global(#spLeftNav) {
display: none;
}
:global(.CanvasZone) {
max-width: 100%;
}
Is member of
import 'core-js/modules/es6.string.includes.js';
import 'core-js/modules/es6.number.is-nan.js';
import 'core-js/es6/array';
import 'es6-map/implement';
import { sp,SPRest } from '@pnp/sp';
import { IWebPartContext } from '@microsoft/sp-webpart-base';
import * as React from 'react';
class PeopleService {
private _context: IWebPartContext;
private _localPnPSetup: SPRest;
public constructor(webPartContext: IWebPartContext) {
this._context = webPartContext;
// To limit the payload size, we set odata=nometadata
// We just need to get list items here
// We use a local configuration to avoid conflicts with other Web Parts
this._localPnPSetup = sp.configure({
headers: {
Accept: 'application/json; odata=nometadata',
},
}, this._context.pageContext.web.absoluteUrl);
}
public async isMemberOf(group: string): Promise{
let groups = await this._localPnPSetup.web.currentUser.groups.get();
let ret: boolean = false;
groups.map(grp =>{
if(grp.LoginName == group)
ret = true;
});
return ret;
}
public async isMemberOfanyGroup(groupNames: string[]): Promise{
let groups = await this._localPnPSetup.web.currentUser.groups.get();
let ret: boolean = false;
groups.map(grp =>{
groupNames.map(name =>{
console.log("name : '" + name + "' grp : '" + grp.LoginName + "'");
if(grp.LoginName == name)
ret = true;
});
});
return ret;
}
}
export default PeopleService;
Taxonomy, get tags, add tags
import { IWebPartContext } from '@microsoft/sp-webpart-base';
import { Session, ITermStore, ITermSet, ITermData, ITerm } from '@pnp/sp-taxonomy';
class TaxonomyService {
private _context: IWebPartContext;
public constructor(webPartContext: IWebPartContext) {
this._context = webPartContext;
}
public async getTags() : Promise{
console.log("Session");
const taxonomy = new Session(this._context.pageContext.site.absoluteUrl);
const store: any = taxonomy.termStores.getByName("Taxonomy_Wf8XzHaRobdAERjvvke+Tg==");
let datas = await store.getTermSetById("c18ff3e6-e4a8-4dcb-85f5-51171f4bbc11").terms.select('Name', 'Id', 'Parent').get();
let ret: string[] = [];
for(let i = 0 ; i < datas.length ; i++)
ret.push(datas[i]);
return datas;
}
public async addNewTag(tag){
const taxonomy = new Session(this._context.pageContext.site.absoluteUrl);
const store: any = taxonomy.termStores.getByName("Taxonomy_Wf8XzHaRobdAERjvvke+Tg==");
let datas = await store.getTermSetById("c18ff3e6-e4a8-4dcb-85f5-51171f4bbc11");
const term: ITerm & ITermData = await datas.addTerm(tag, 1036, true);
}
}
export default TaxonomyService;