migrating-to-westpac-ui-v1
westpacgel/gel-next · skills.sh
Open source Repository Open in the app JSON README (API)
About
Skill publicada por westpacgel/gel-next no skills.sh. Instale com: npx skills add westpacgel/gel-next@migrating-to-westpac-ui-v1
Details
- Kind
- Agent skills
- Publisher
- westpacgel
- Origin
- skillssh
- Category
- ferramentas
- Stars
- 23
- Forks
- 18
- Open pull requests
- 2
- Last push
- 2026-10-07T05:00:21Z
- Repository state
- ativo
- Language
- TypeScript
- Added
- 2026-10-07 06:28:22
- Updated
- 2026-10-07 06:28:22
- Origin id
westpacgel/gel-next/migrating-to-westpac-ui-v1
README
### Previous Version
If you are looking for information/source code for version 0.x you can find it [here](https://github.com/WestpacGEL/GEL-next/tree/version/0.x). It is recommened you upgrade to 1.0 at your earliest convenience.
- [Storybook](https://gel-next-storybook-git-version-0x-westpacgel.vercel.app/?path=/story/attention--attention).
- [Site](https://gel-next-site-git-version-0x-westpacgel.vercel.app/)
## Getting Started
This section describes how to get started with Westpac GEL.
### What is GEL?
The Global Experience Language is our single source of truth, providing everything you need to deliver our brand promises and create consistent, coherent customer experiences across our entire digital landscape faster, and with less effort.
You can read more about GEL in [https://gel.westpacgroup.com.au/articles/what-is-GEL](https://gel.westpacgroup.com.au/articles/what-is-GEL)
### Pre-requisites
All GEL components have a couple of dependencies so please ensure the following are installed using your preferred package manager (`npm`, `yarn` or `pnpm`):
```
npm i react@^18.2.0
npm i -D tailwindcss @tailwindcss/postcss postcss
```
GEL is using [Tailwind](https://tailwindcss.com/) for styling. Visit the [Tailwind docs](https://tailwindcss.com/docs/installation/framework-guides) and follow the relevant instructions for installation.
### Agent Skills
We have some skills available to use with AI agents:
- `using-westpac-ui` - **Highly recommended**: Provides general context for all components in the library, has reference material generated from the [docs site](https://gel.westpacgroup.com.au/design-system/wbc) content and usage examples of components.
- `installing-westpac-ui` - **Optional**: Skill that provides context for installing GEL Next in a fresh project.
- `migrating-to-westpac-ui-v1` - **Optional**: Skill that provides context for migrating from pre-1.0 GEL Next to >1.0 GEL Next
#### Skill Installation
The recommended way to install skills is to use the following command, from this you can select the skills you wish to install:
`npx skills add https://github.com/WestpacGEL/GEL-next/tree/main/.agents/skills/consumer/`
If you can't use the `skills` cli for any reason you can just retrieve the skills manually from the [GEL Next GitHub](https://github.com/WestpacGEL/GEL-next/tree/main/.agents/skills/consumer/)
### Installation
The GEL is separated out into 2 packages.
- `@westpac/ui` - React components
- `@westpac/style-config` - Tailwind/CSS/tokens
Install the GEL packages using preferred package manager (`npm`, `yarn` or `pnpm`):
```
npm i @westpac/ui @westpac/style-config
```
Create a `postcss.config.mjs` on the root of your application as follows.
```js
import { postcssConfig } from '@westpac/style-config/postcss';
export default postcssConfig;
```
In your main CSS file, import the Tailwind directives and GEL styles:
```css
@import 'tailwindcss';
/* Tailwind setup */
@import '@westpac/style-config/tailwind';
/* Register GEL components source for tailwind */
@source "<relative_path>/node_modules/@westpac/ui/src";
```
For brand theming, import the required brand stylesheets:
```css
@import '@westpac/style-config/themes/wbc';
@import '@westpac/style-config/themes/stg';
@import '@westpac/style-config/themes/bom';
@import '@westpac/style-config/themes/bsa';
```
If you have initialized your project with Nx build system follow the official [Nx tailwind documentation](https://nx.dev/recipes/react/using-tailwind-css-in-react#manual-setup-instructions) to configure tailwind.
### Theming
To switch between brands, set the `data-brand` attribute on a parent element:
```html
<div data-brand="wbc">
<!-- Your app content -->
</div>
```
NOTE: Do not include code to activate dark mode if it hasn't been approved for your team yet
To toggle between light and dark mode, set the `data-theme` attribute:
```html
<div data-brand="wbc" data-theme="dark">
<!-- Your app content -->
</div>
```
### Usage
#### Using brands
Add a custom attribute tag `data-brand="brand_name"` to `html` tag. Note that instead of adding the custom attribute to html tag, you can add it to the parent tag of your application as well.
Following example shows adding `wbc` brand. You can add other valid brand names such as `stg`, `bom`, `bsa` etc. as the value.
```html
<!doctype html>
<html lang="en" data-brand="wbc">
...
</html>
```
NOTE: Do not include code to activate dark mode if it hasn't been approved for your team yet
For theme modes (light/dark), use the `data-theme` attribute:
```html
<!doctype html>
<html lang="en" data-brand="wbc" data-theme="light">
...
</html>
```
**NOTE:** There are some components that use portals `Modal`, `BottomSheet`, `AutoComplete`. These components will default their portal to where you add your `data-brand` attribute tag so these components can make use of branding. This can be overridden using their `portalContainer` props if you require the portal to be located elsewhere.
Now you can start using the GEL components in your `React.js` application. The following examples show how to use the `Button` component.
For detailed documentation refer to [https://gel.westpacgroup.com.au/design-system](https://gel.westpacgroup.com.au/design-system).
### Tokens
All brand tokens are also exported in the [W3C design tokens format](https://www.designtokens.org/tr/drafts/format/)
```js
import { ALL_BRANDS } from '@westpac/style-config/tokens';
```
#### Tokens usage with Tailwind
All brand tokens have been mapped to a color theme variable in the tailwind config and can be used in the relevant tailwind classname e.g. `bg-surface-mono text-text-body`
All available color tokens can be viewed in the [GEL storybook](https://gel-next-storybook-westpacgel.vercel.app/?path=/docs/foundation-colours--docs).
### Brand fonts
In order to use brand-fonts add the relevant font face declarations from the below example and update the src to the font file locations in your application.
```css
/* BOM fonts */
@font-face {
src:
url('/fonts/lineto-brown-pro-light.woff2') format('woff2'),
url('/fonts/lineto-brown-pro-light.woff') format('woff');
font-family: 'Brown Pro';
font-weight: 100 300;
font-style: normal;
}
@font-face {
src:
url('/fonts/lineto-brown-pro-regular.woff2') format('woff2'),
url('/fonts/lineto-brown-pro-regular.woff') format('woff');
font-family: 'Brown Pro';
font-weight: 400 600;
font-style: normal;
}
@font-face {
src:
url('/fonts/lineto-brown-pro-bold.woff2') format('woff2'),
url('/fonts/lineto-brown-pro-bold.woff') format('woff');
font-family: 'Brown Pro';
font-weight: 700 900;
font-style: normal;
}
/* BSA fonts */
@font-face {
src:
url('/fonts/Aller_Lt.woff2') format('woff2'),
url('/fonts/Aller_Lt.woff') format('woff');
font-family: 'Aller';
font-weight: 100 600;
font-style: normal;
}
@font-face {
src:
url('/fonts/Aller_Bd.woff2') format('woff2'),
url('/fonts/Aller_Bd.woff') format('woff');
font-family: 'Aller';
font-weight: 700 900;
font-style: normal;
}
/* STG fonts */
@font-face {
src:
url('/fonts/dragonbold-bold-webfont.woff2') format('woff2'),
url('/fonts/dragonbold-bold-webfont.woff') format('woff');
font-family: 'Dragon Bold';
font-weight: 100 900;
font-style: normal;
}
/* WBC fonts */
@font-face {
src:
url('/fonts/Westpac-Bold-v2.007.woff2') format('woff2'),
url('/fonts/Westpac-Bold-v2.007.woff') format('woff');
font-family: 'Westpac';
font-weight: 100 900;
font-style: normal;
}
```
#### Individual package import
We recommended the individual package import approach if you have issues with [Tree shaking](https://developer.mozilla.org/en-US/docs/Glossary/Tree_shaking).
```tsx
import { Button } from '@westpac/ui/button';
export default function SampleApp() {
return (
<section>
<div className="space-x-4 mb-2">
<Button look="primary">Pay here</Button>
</div>
</section>
);
}
```
#### Mono package import
Modern bundlers like [Vite](https://vitejs.dev/) and latest [webpack](https://webpack.js.org/) will automatically detect the individual components and only bundle the components you use.
However, use this approach with caution as it may cause issues with [Tree shaking](https://developer.mozilla.org/en-US/docs/Glossary/Tree_shaking) since not all bundlers have this advanced capability.
```tsx
import { Button } from '@westpac/ui';
export default function SampleApp() {
return (
<section>
<div className="space-x-4 mb-2">
<Button look="primary">Pay here</Button>
</div>
</section>
);
}
```
### Unit testing
We recommend [Vitest](https://vitest.dev/) for unit testing since [Vitest](https://vitest.dev/guide/why.html) natively supports [ES modules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules).
If you are using [Jest](https://jestjs.io/) for unit testing, you might encounter some issues since [Jest](https://jestjs.io/docs/ecmascript-modules) does not support [ES modules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules) by default. Therefore, you will need to make following configuration changes.
Update the `package.json` file if you have initialized your project with [Create React App](https://create-react-app.dev/).
```json
{
"scripts": {
"test": "node scripts/test.js --transformIgnorePatterns \"node_modules/(?!(@westpac/ui)/)\""
}
}
```
Update the `jest.config.js` file if you have initialized your project with [Nx build system](https://nx.dev/) and [Babel](https://babeljs.io/).
```js
{
transform: {
'^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nrwl/react/babel'] }]
},
transformIgnorePatterns: ['node_modules/(?!(@westpac/ui|@westpac/style-config))']
}
```
### Codemods
Codemods are provided to help migrate your codebase when GEL introduces breaking changes or API updates.
#### Running a codemod
We use [jscodeshift](https://github.com/facebook/jscodeshift) to run codemods.
To apply a codemod, install `jscodeshift` if you don’t already have it:
```bash
npm install -g jscodeshift
```
Then run the codemod against your source files. For example:
```bash
npx jscodeshift -t ./codemods/update-date-picker.js src/
```
-t points to the codemod file.
src/ is the folder you want to transform (adjust as needed).
Example
```bash
npx jscodeshift --parser=tsx -t node_modules/@westpac/ui/scripts/codemods/gel-tokens-tailwind-v1.cjs <path>/**/*.tsx
```
This will apply the gel-tokens-v1 codemod to all .tsx files in your project.
## Documentation
Visit [https://gel.westpacgroup.com.au/design-system](https://gel.westpacgroup.com.au/design-system) to view the full documentation.
## Contributing to GEL
### Developing
- The development branch is `develop`.
- All pull requests should be opened against `develop`.
- The changes on the `develop` branch are published to the `preview` environment.
#### To develop locally (common for all the packages and apps)
1. Install Node.js 22.x or above. We recommend [https://github.com/nvm-sh/nvm](https://github.com/nvm-sh/nvm) to install Node.js.
2. Clone the Next.js repository:
```
git clone --single-branch --branch develop git@github.com:WestpacGEL/GEL-next.git
```
3. Create a new branch:
```
git checkout -b MY_BRANCH_NAME origin/develop
```
4. Enable pnpm:
```
corepack enable pnpm
```
5. Install the dependencies with:
```
pnpm install
```
6. Start developing and watch for code changes:
```
pnpm dev
```
7. Run the unit tests with:
```
pnpm test
```
8. Fix formatting and linting with:
```
pnpm format:fix && pnpm lint:fix
```
9. Check formatting and linting with:
```
pnpm format && pnpm lint
```
10. Check TypeScript compatibility with:
```
pnpm check-types
```
11. You can build packages and apps with:
```
pnpm build
```
12. You can add a changeset with:
```
pnpm changeset
```
##### To develop a GEL UI component locally
1. Change the working directory with:
```
cd packages/ui
```
2. Create a new `GEL` component with:
```
cd packages/ui
pnpm generate:component
```
3. Start storybook with:
```
pnpm build && pnpm storybook
```
4. Run the unit tests in watch mode with:
```
pnpm test:watch
```
When your changes are finished, commit them to the branch and push it to origin.