A Simple Type Definition Extension Library For Material UI 5
MIT License
TypeScript React
ย
ย
Sx
Type
sx
sx
styles outside theUsage
sectionย
ย
18.3.1
18.3.3
18.3.1
18.3.0
14.2.3
6.0.1
ย
ย
npm add -D @best-skn/mui-types #or yarn add -D @best-skn/mui-types #or pnpm add -D @best-skn/mui-types #or bun add -D @best-skn/mui-types
types
in the root location of your project, and create a file called mui.d.ts
, then do thisimport "@best-skn/mui-types";
tsconfig.json
if includes
property has **/*.ts
, **/*.tsx
otherwise the type definition file may not workSx
Type:
sx
in separate fileimport type { Sx } from "@mui/material"; type Key = "container" | "box"; // * Create sx names here export const sx: Sx<Key> = { //* You'll get total intellisense for `sx` names container: { //* You'll get intellisense for Material UI SX styles inside display: "flex", //* other styles here... }, box: { color: "blue", //* other styles here... }, };
sx
inside components in Next.js"use client" import Typography from "@mui/material/Typography"; import { sx } from "./sx.ts"; const HomeComponent: React.FC<unknown> = () => { return ( <Typography variant="h6" component="div" sx={sx.box} //* Use `sx` style here > Home Component </Typography> ); }; export default HomeComponent;
ย
Tanjila Hasan Trina
: The long lost love of my life. The course of nature separated us from our paths and put us in separate places far away from each other. But no matter how separated we are right now, each and every moment of mine is only dedicated to you. We may not see each other in this lifetime as it seems but I will find you again in the next life. I just want to say: ไธ็ใฏๆฎ้
ทใ ใใใงใๅใๆใใ
My Parents
: The greatest treasures of my life ever.ย
Copyright (C) 2024 SKN Shukhan
Licensed under the MIT License