diff --git a/docs/api/04-standard-library/aws/api-reference.md b/docs/api/04-standard-library/aws/api-reference.md index e892e364e2b..3df7541c23a 100644 --- a/docs/api/04-standard-library/aws/api-reference.md +++ b/docs/api/04-standard-library/aws/api-reference.md @@ -1,5 +1,5 @@ --- -title: API reference +title: API Reference id: api-reference description: Wing standard library API reference for the aws module keywords: [Wing sdk, sdk, Wing API Reference] diff --git a/docs/api/04-standard-library/expect/api-reference.md b/docs/api/04-standard-library/expect/api-reference.md index 2dc3972033f..80d739709f6 100644 --- a/docs/api/04-standard-library/expect/api-reference.md +++ b/docs/api/04-standard-library/expect/api-reference.md @@ -1,5 +1,5 @@ --- -title: API reference +title: API Reference id: api-reference description: Wing standard library API reference for the expect module keywords: [Wing sdk, sdk, Wing API Reference] diff --git a/docs/api/04-standard-library/fs/api-reference.md b/docs/api/04-standard-library/fs/api-reference.md index d1f9e903155..04ae46446af 100644 --- a/docs/api/04-standard-library/fs/api-reference.md +++ b/docs/api/04-standard-library/fs/api-reference.md @@ -1,5 +1,5 @@ --- -title: API reference +title: API Reference id: api-reference description: Wing standard library API reference for the fs module keywords: [Wing sdk, sdk, Wing API Reference] diff --git a/docs/api/04-standard-library/http/api-reference.md b/docs/api/04-standard-library/http/api-reference.md index e80f4ba23ed..e2eb4284328 100644 --- a/docs/api/04-standard-library/http/api-reference.md +++ b/docs/api/04-standard-library/http/api-reference.md @@ -1,5 +1,5 @@ --- -title: API reference +title: API Reference id: api-reference description: Wing standard library API reference for the http module keywords: [Wing sdk, sdk, Wing API Reference] diff --git a/docs/api/04-standard-library/math/api-reference.md b/docs/api/04-standard-library/math/api-reference.md index d0bbd66381b..0a6fd8d3265 100644 --- a/docs/api/04-standard-library/math/api-reference.md +++ b/docs/api/04-standard-library/math/api-reference.md @@ -1,5 +1,5 @@ --- -title: API reference +title: API Reference id: api-reference description: Wing standard library API reference for the math module keywords: [Wing sdk, sdk, Wing API Reference] diff --git a/docs/api/04-standard-library/sim/api-reference.md b/docs/api/04-standard-library/sim/api-reference.md index 058af73e049..777a190ab73 100644 --- a/docs/api/04-standard-library/sim/api-reference.md +++ b/docs/api/04-standard-library/sim/api-reference.md @@ -1,5 +1,5 @@ --- -title: API reference +title: API Reference id: api-reference description: Wing standard library API reference for the sim module keywords: [Wing sdk, sdk, Wing API Reference] diff --git a/docs/api/04-standard-library/ui/_category_.yml b/docs/api/04-standard-library/ui/_category_.yml index d7b43b21f9c..026c3df3109 100644 --- a/docs/api/04-standard-library/ui/_category_.yml +++ b/docs/api/04-standard-library/ui/_category_.yml @@ -1,5 +1,3 @@ label: ui collapsible: true collapsed: true -link: - type: generated-index \ No newline at end of file diff --git a/docs/api/04-standard-library/ui/api-reference.md b/docs/api/04-standard-library/ui/api-reference.md index fb65ba29f9a..5c7f9f67316 100644 --- a/docs/api/04-standard-library/ui/api-reference.md +++ b/docs/api/04-standard-library/ui/api-reference.md @@ -1,5 +1,5 @@ --- -title: API reference +title: API Reference id: api-reference description: Wing standard library API reference for the ui module keywords: [Wing sdk, sdk, Wing API Reference] diff --git a/docs/api/04-standard-library/ui/index.mdx b/docs/api/04-standard-library/ui/index.mdx new file mode 100644 index 00000000000..dc7da809ae9 --- /dev/null +++ b/docs/api/04-standard-library/ui/index.mdx @@ -0,0 +1,57 @@ +--- +title: "ui module" +id: ui +--- + +The `ui` module lets you create tools for interacting with resources in the Wing Console. + +Using components like `ui.Button`, `ui.Field`, or `ui.Table`, it's possible to trigger actions in Wing apps or display important information to the user. + +Here's an example of a class which has a button and field showing the internal state of the resource: + +```js playground example +bring cloud; +bring ui; + +class WidgetService { + data: cloud.Bucket; + counter: cloud.Counter; + new() { + this.data = new cloud.Bucket(); + this.counter = new cloud.Counter(); + + // a button lets you invoke any inflight function + new ui.Button("Add widget", inflight () => { this.addWidget(); }); + + // a field displays a labeled value + new ui.Field( + "Total widgets", + inflight () => { return this.countWidgets(); }, + refreshRate: 5s, + ); + } + + inflight addWidget() { + let id = this.counter.inc(); + this.data.put("widget-{id}", "my data"); + } + + inflight countWidgets(): str { + return "{this.data.list().length}"; + } +} + +new WidgetService(); +``` + +Here is what the UI looks like in the Wing Console: + +![](./widget-service-example.png) + +--- + +```mdx-code-block +import DocCardList from '@theme/DocCardList'; + + +``` diff --git a/docs/api/04-standard-library/ui/widget-service-example.png b/docs/api/04-standard-library/ui/widget-service-example.png new file mode 100644 index 00000000000..76677b8ca12 Binary files /dev/null and b/docs/api/04-standard-library/ui/widget-service-example.png differ diff --git a/docs/api/04-standard-library/util/api-reference.md b/docs/api/04-standard-library/util/api-reference.md index ee63f0ad45b..8628868741a 100644 --- a/docs/api/04-standard-library/util/api-reference.md +++ b/docs/api/04-standard-library/util/api-reference.md @@ -1,5 +1,5 @@ --- -title: API reference +title: API Reference id: api-reference description: Wing standard library API reference for the util module keywords: [Wing sdk, sdk, Wing API Reference] diff --git a/packages/@winglang/sdk/scripts/docgen.mts b/packages/@winglang/sdk/scripts/docgen.mts index f27d77c770d..f84f3ef278a 100644 --- a/packages/@winglang/sdk/scripts/docgen.mts +++ b/packages/@winglang/sdk/scripts/docgen.mts @@ -21,7 +21,7 @@ const getStdlibDocsDir = (name: string) => { }; const docsFrontMatter = (name: string) => `--- -title: API reference +title: API Reference id: api-reference description: Wing standard library API reference for the ${name} module keywords: [Wing sdk, sdk, Wing API Reference] @@ -33,7 +33,6 @@ sidebar_position: 100 `; const UNDOCUMENTED_CLOUD_FILES = ["index", "test-runner"]; -const UNDOCUMENTED_EX_FILES = ["index"]; const UNDOCUMENTED_STD_FILES = [ "README", "index",