webf-api-compatibility
Check Web API and CSS feature compatibility in WebF - determine what JavaScript APIs, DOM…
Develop custom native UI libraries based on Flutter widgets for WebF. Create reusable component libraries that wrap Flutter widgets as web-accessible custom elements. Use when building UI libraries, wrapping Flutter packages, or creating native component systems.
$ npx -y skills add openwebf/webf --skill webf-native-ui-dev --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/webf-native-ui-devContext preview
The summary Claude sees to decide when to auto-load this skill.
Develop custom native UI libraries based on Flutter widgets for WebF. Create reusable component libraries that wrap Flutter widgets as web-accessible custom elements. Use when building UI libraries, wrapping Flutter packages, or creating native component systems.
name: webf-native-ui-dev description: Develop custom native UI libraries based on Flutter widgets for WebF. Create reusable component libraries that wrap Flutter widgets as web-accessible custom elements. Use when building UI libraries, wrapping Flutter packages, or creating native component systems.
Want to create your own native UI library for WebF by wrapping Flutter widgets? This skill guides you through the complete process of building custom native UI libraries that make Flutter widgets accessible from JavaScript/TypeScript with React and Vue support.
Native UI development in WebF means:
A native UI library consists of three layers:
┌─────────────────────────────────────────┐ │ JavaScript/TypeScript (React/Vue) │ ← Generated by CLI │ @openwebf/my-component-lib │ ├─────────────────────────────────────────┤ │ TypeScript Definitions (.d.ts) │ ← You write this │ Component interfaces and events │ ├─────────────────────────────────────────┤ │ Dart (Flutter) │ ← You write this │ Flutter widget wrappers │ │ my_component_lib package │ └─────────────────────────────────────────┘
# 1. Create Flutter package with Dart wrappers # 2. Write TypeScript definition files # 3. Generate React/Vue components with WebF CLI # 4. Test and publish webf codegen my-ui-lib --flutter-package-src=./flutter_package
Create a standard Flutter package:
# Create Flutter package flutter create --template=package my_component_lib cd my_component_lib
**Directory structure:**
my_component_lib/ ├── lib/ │ ├── my_component_lib.dart # Main export file │ └── src/ │ ├── button.dart # Dart widget wrapper │ ├── button.d.ts # TypeScript definitions │ ├── input.dart │ └── input.d.ts ├── pubspec.yaml └── README.md
**pubspec.yaml dependencies:**
dependencies:
flutter:
sdk: flutter
webf: ^0.24.0 # Latest WebF versionCreate a Dart class that wraps your Flutter widget:
**Example: lib/src/button.dart**
import 'package:flutter/widgets.dart';
import 'package:webf/webf.dart';
import 'button_bindings_generated.dart'; // Will be generated by CLI
/// Custom button component wrapping Flutter widgets
class MyCustomButton extends MyCustomButtonBindings {
MyCustomButton(super.context);
// Internal state
String _variant = 'filled';
bool _disabled = false;
// Property getters/setters (implement interface from bindings)
@override
String get variant => _variant;
@override
set variant(String value) {
_variant = value;
// Trigger rebuild when property changes
setState(() {});
}
@override
bool get disabled => _disabled;
@override
set disabled(bool value) {
_disabled = value;
setState(() {});
}
@override
WebFWidgetElementState createState() {
return MyCustomButtonState(this);
}
}
class MyCustomButtonState extends WebFWidgetElementState {
MyCustomButtonState(super.widgetElement);
@override
MyCustomButton get widgetElement => super.widgetElement as MyCustomButton;
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: widgetElement.disabled ? null : () {
// Dispatch click event to JavaScript
widgetElement.dispatchEvent(Event('click'));
},
child: Container(
padding: EdgeInsets.all(12),
decoration: BoxDecoration(
color: _getBackgroundColor(),
borderRadius: BorderRadius.circular(8),
),
child: Text(
// Get text from child nodes
widgetElement.getTextContent() ?? 'Button',
style: TextStyle(
color: widgetElement.disabled ? Colors.grey : Colors.white,
),
),
),
);
}
Color _getBackgroundColor() {
if (widgetElement.disabled) return Colors.grey[400]!;
switch (widgetElement.variant) {
case 'filled':
return Colors.blue;
case 'outlined':
return Colors.transparent;
default:
return Colors.blue;
}
}
}Create a `.d.ts` file alongside your Dart file:
**Example: lib/src/button.d.ts**
/**
* Custom button component with multiple variants.
*/
/**
* Properties for <my-custom-button>.
*/
interface MyCustomButtonProperties {
/**
* Button variant style.
* Supported values: 'filled' | 'outlined' | 'text'
* @default 'filled'
*/
variant?: string;
/**
* Whether the button is disabled.
* @default false
*/
disabled?: boolean;
}
/**
* Events for <my-custom-button>.
*/
interface MyCustomButtonEvents {
/**
* Fired when the button is clicked.
*/
click: Event;
}**TypeScript Guidelines:**
Repo: openwebf/webf
Check Web API and CSS feature compatibility in WebF - determine what JavaScript APIs, DOM…
Understand and work with WebF's async rendering model - handle onscreen/offscreen events and…
Create high-performance infinite scrolling lists with pull-to-refresh and load-more…
Develop custom WebF native plugins based on Flutter packages. Create reusable plugins that…
Install WebF native plugins to access platform capabilities like sharing, payment, camera,…
Setup and use WebF's Cupertino UI library to build native iOS-style UIs with pre-built…