A comprehensive demo project showcasing the exciting new Spring '26 features for Salesforce developers
This repository contains working examples of the most impactful Spring '26 features for Salesforce developers. Each demo is fully functional and ready to deploy to your scratch org or sandbox.
| Category | Feature | Status |
|---|---|---|
| 🎨 LWC | TypeScript Support | ✅ GA |
| 🎯 LWC | Dynamic Event Binding (lwc:on) | ✅ GA |
| 📝 LWC | Complex Template Expressions | 🧪 Beta |
| 🖼️ LWC | Empty State Components | 🧪 Beta |
| 🔄 LWC | GraphQL Mutations | ✅ GA |
| 🔀 LWC | Flow Navigation | ✅ GA |
| ⚙️ Apex | Picklist Values by Record Type | ✅ GA |
| 📄 Apex | Visualforce PDF Rendering | ✅ GA |
Location: force-app/main/default/lwc/typescriptDemo/
Spring '26 brings native TypeScript support to Lightning Web Components! Write type-safe code with full IntelliSense for Lightning base components.
- 🎯 Full type definitions via
@salesforce/lightning-typesnpm package - 🔍 IntelliSense for all Lightning base components
- ✅ Compile-time type checking
- 📖 Better documentation through types
import { LightningElement } from 'lwc';
import LightningInput from 'lightning/input';
import LightningButton from 'lightning/button';
export default class TypescriptDemo extends LightningElement {
inputValue: string = '';
clickCount: number = 0;
// Typed event handler with full IntelliSense
handleInputChange(event: Event): void {
const input = event.target as LightningInput;
this.inputValue = input.value ?? '';
}
// Computed property with explicit return type
get buttonVariant(): string {
return this.clickCount > 5 ? 'success' : 'brand';
}
}npm install @salesforce/lightning-types --save-devLocation: force-app/main/default/lwc/dynamicEventDemo/
The new lwc:on directive allows you to dynamically attach multiple event listeners using a computed object. Perfect for building configurable, interactive components!
- 🔄 Dynamic event listener attachment
- ⚡ Computed event handlers based on state
- 🎮 Perfect for games, interactive UIs, and accessibility
- 📱 Easily switch between touch/click/hover modes
<!-- Template: Attach dynamic handlers -->
<div lwc:on={pad.eventHandlers} class="beat-pad">
{pad.label}
</div>// JavaScript: Compute handlers dynamically
computeEventHandlers(padId) {
const handlers = {};
// Always include base handlers
handlers.mousedown = (e) => this.handleTrigger(e, padId);
handlers.mouseup = (e) => this.handleRelease(e, padId);
// Conditionally add hover handlers
if (this.mode === 'hover') {
handlers.mouseenter = (e) => this.handleTrigger(e, padId);
}
// Conditionally add touch handlers
if (this.mode === 'touch') {
handlers.touchstart = (e) => this.handleTrigger(e, padId);
handlers.touchend = (e) => this.handleRelease(e, padId);
}
return handlers;
}🎵 Interactive Beat Pad Machine - A fun drum machine that demonstrates dynamic event binding with different trigger modes (click, hover, touch, all).
Location: force-app/main/default/lwc/templateExpressionsDemo/
Write JavaScript expressions directly in your templates! No more getter methods for simple logic.
- 📐 Ternary operators:
{isActive ? 'Active' : 'Inactive'} - 📝 Template literals:
{`Hello, ${name}!`} - ➕ Arithmetic:
{price * quantity} - 🔗 Optional chaining:
{user?.profile?.name} - ❓ Nullish coalescing:
{value ?? 'default'} - 🔢 Array methods:
{items.filter(i => i.active).length} - 📞 Function calls:
{formatCurrency(total)} - 🖱️ Inline handlers:
{() => count++}
<template>
<!-- Template Literals -->
<p>{`Welcome, ${firstName} ${lastName}!`}</p>
<!-- Ternary Operators -->
<p>{isLoggedIn ? 'Welcome back!' : 'Please log in'}</p>
<p>{score > 80 ? 'Excellent' : score > 60 ? 'Good' : 'Needs Work'}</p>
<!-- Optional Chaining + Nullish Coalescing -->
<p>Theme: {user?.profile?.settings?.theme ?? 'light'}</p>
<!-- Arithmetic & Function Calls -->
<p>Total: {formatCurrency(price * quantity * (100 - discount) / 100)}</p>
<!-- Array Methods -->
<p>In Stock: {items.filter(item => item.inStock).length} items</p>
<!-- Inline Event Handlers -->
<lightning-button onclick={() => quantity++} label="Add" />
<!-- Dynamic Classes -->
<div class={isActive ? 'slds-text-color_success' : 'slds-text-color_error'}>
Status
</div>
</template>Location: force-app/main/default/lwc/emptyStateDemo/
New base components for displaying empty states with beautiful, theme-adaptive illustrations.
- 🎨 Theme-adaptive (works with SLDS 1/2 and dark mode)
- 📱 Responsive design
- 🎯 Multiple illustration types
- 🔘 Built-in CTA button slots
| Component | Use Case |
|---|---|
lightning-empty-state |
Full empty state with title, description, and CTA |
lightning-illustration |
Illustration only (no text) |
<!-- Full Empty State -->
<lightning-empty-state
illustration-name="cart:noitems"
title="Your cart is empty">
<p slot="description">
Browse our product catalog to find items you love.
</p>
<lightning-button
variant="brand"
label="Browse Products"
slot="cta"
onclick={handleBrowse}>
</lightning-button>
</lightning-empty-state>
<!-- Illustration Only -->
<lightning-illustration
illustration-name="noTask"
alternative-text="No tasks remaining">
</lightning-illustration>cart:noitems- Empty shopping cartnoTask- All tasks completenoResult- No search results- And many more from the SLDS illustration library!
Location: force-app/main/default/lwc/graphqlMutationDemo/
The new executeMutation function enables Create, Update, and Delete operations via GraphQL!
- ✨ Create records with
ContactCreate - 📝 Update records with
ContactUpdate - 🗑️ Delete records with
ContactDelete - 🔄 Full integration with
@wirefor queries - 📄 Cursor-based pagination support
import { gql, graphql, executeMutation } from 'lightning/graphql';
// Define mutation
get createQuery() {
return gql`
mutation CreateContact($input: ContactCreateInput!) {
uiapi {
ContactCreate(input: $input) {
Record {
Id
FirstName { value }
LastName { value }
}
}
}
}
`;
}
// Execute mutation
async handleCreate() {
const result = await executeMutation({
query: this.createQuery,
variables: {
input: {
Contact: {
FirstName: this.firstName,
LastName: this.lastName,
Email: this.email
}
}
}
});
const newRecord = result.data.uiapi.ContactCreate.Record;
console.log('Created:', newRecord.Id);
}📇 Contact Manager - A full CRUD application demonstrating create, read, update, and delete operations with GraphQL, including pagination.
Location: force-app/main/default/lwc/flowNavigationDemo/
Navigate to Flows directly from LWC using the new standard__flow PageReference type!
- 🔗 Navigate to any Flow by developer name
- 📥 Pass input variables to Flows
- 🔗 Generate Flow URLs for sharing
import { NavigationMixin } from 'lightning/navigation';
export default class FlowNav extends NavigationMixin(LightningElement) {
// Simple navigation to a Flow
navigateToFlow() {
this[NavigationMixin.Navigate]({
type: 'standard__flow',
attributes: {
devName: 'MyFlowApiName'
}
});
}
// Navigate with input variables (prefix with 'flow__')
navigateWithInputs() {
this[NavigationMixin.Navigate]({
type: 'standard__flow',
attributes: {
devName: 'MyFlowApiName'
},
state: {
flow__recordId: this.recordId,
flow__userName: 'Trailblazer'
}
});
}
// Generate a shareable URL
async generateUrl() {
const url = await this[NavigationMixin.GenerateUrl]({
type: 'standard__flow',
attributes: {
devName: 'MyFlowApiName'
}
});
console.log('Flow URL:', url);
}
}Location: force-app/main/default/classes/PicklistValuesByRecordTypeDemo.cls
Get all picklist values for a specific record type in a single call - no callouts required!
- 🚀 Single API call for all picklist fields
- 🔗 Includes dependent picklist relationships
- 📋 Works with custom and standard fields
- ⚡ No callouts or HTTP requests needed
// Get all picklist values for a record type
ConnectApi.PicklistValuesCollection picklistCollection =
ConnectApi.RecordUi.getPicklistValuesByRecordType(
'Case', // Object API Name
recordTypeId // Record Type Id
);
// Access specific field values
if (picklistCollection.picklistFieldValues != null) {
ConnectApi.PicklistValues statusValues =
picklistCollection.picklistFieldValues.get('Status');
for (ConnectApi.PicklistValue pv : statusValues.values) {
System.debug('Status: ' + pv.label + ' = ' + pv.value);
}
}
// Handle dependent picklists
if (fieldValues.controllerValues != null) {
// This field is dependent - get valid values per controller
Map<String, Integer> controllerMap = fieldValues.controllerValues;
// Filter values based on controlling field selection
}- 🎯 Dynamic forms based on record type
- 📝 Dependent picklist cascades
- ✅ Validation of picklist values
- 🔄 Sync picklist values to external systems
Location: force-app/main/default/classes/VisualforcePdfRenderingDemo.cls
Blob.toPdf() now uses the Visualforce PDF rendering service with enhanced font and language support!
- 🌍 Full multibyte character support (CJK, Thai, Arabic, Hindi, etc.)
- 🔤 New default font: sans-serif (previously serif)
- 🎨 Extended font families including Arial Unicode MS
- 📄 Consistent rendering with Visualforce PDFs
// Generate a multilingual PDF
String html = '<!DOCTYPE html>' +
'<html><body>' +
'<h1>Global Support</h1>' +
'<p>Japanese: こんにちは</p>' +
'<p>Chinese: 你好世界</p>' +
'<p>Korean: 안녕하세요</p>' +
'<p>Thai: สวัสดี</p>' +
'<p>Arabic: مرحبا</p>' +
'</body></html>';
Blob pdfBlob = Blob.toPdf(html);
// Save to Files
ContentVersion cv = new ContentVersion();
cv.Title = 'Multilingual Document';
cv.PathOnClient = 'document.pdf';
cv.VersionData = pdfBlob;
insert cv;
⚠️ Breaking Change: Default font changed fromseriftosans-serifIf your PDFs rely on the old serif appearance, explicitly set:
body { font-family: serif; }
| Font | Best For |
|---|---|
| Arial Unicode MS | International characters (CJK) |
| Helvetica | Clean sans-serif |
| Times New Roman | Classic serif |
| Courier New | Monospace / code |
| Georgia | Elegant serif |
| Verdana | Wide sans-serif |
| sans-serif | NEW DEFAULT |
| serif | Old default |
- Salesforce CLI (
sf) - Node.js 18+ and npm
- VS Code with Salesforce Extension Pack (recommended)
- A Salesforce org (scratch org, sandbox, or dev org)
-
Clone the repository
git clone https://github.com/your-username/spring26-demos.git cd spring26-demos -
Install dependencies
npm install
-
Authorize your org
sf org login web --alias my-org
-
Deploy to your org
sf project deploy start --target-org my-org
-
Open the org
sf org open --target-org my-org
For TypeScript support in LWC:
# Install TypeScript types
npm install @salesforce/lightning-types --save-dev
# The tsconfig.json is already configured in the lwc folderspring26-demos/
├── force-app/main/default/
│ ├── classes/
│ │ ├── PicklistValuesByRecordTypeDemo.cls # ConnectApi picklist demo
│ │ ├── VisualforcePdfRenderingDemo.cls # PDF rendering demo
│ │ └── ...
│ ├── lwc/
│ │ ├── typescriptDemo/ # TypeScript support
│ │ ├── dynamicEventDemo/ # lwc:on directive
│ │ ├── templateExpressionsDemo/ # Template expressions
│ │ ├── emptyStateDemo/ # Empty state components
│ │ ├── graphqlMutationDemo/ # GraphQL mutations
│ │ └── flowNavigationDemo/ # Flow navigation
│ └── flows/
│ └── SimpleGreetingFlow.flow-meta.xml # Sample flow
├── scripts/
│ └── apex/
│ └── visualforcePdfDemo.apex # PDF demo script
├── package.json
└── README.md
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
Built with ❤️ for Salesforce Developers
⭐ Star this repo if you found it helpful!