
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎Sep 09, 2020 05:59 AM
Is there a way to create a Dropdown Menu inside a custom Block to filter by own configured Airtable Views?
I’am not quite sure if this is what would work for my case.
Is there any Example Demo/Code for that?
Thanks!
Solved! Go to Solution.
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎Sep 09, 2020 10:35 AM
Can I assume that you’re programming this custom Block? If so, then I believe what you’re looking for is ViewPicker
:
import React, { useState } from "react";
import { ViewPicker, useBase } from "@airtable/blocks/ui";
const ViewPickerExample = () => {
const [view, setView] = useState(null);
const base = useBase();
const table = base.getTableByNameIfExists("Tasks");
// If table is null or undefined, the ViewPicker will not render.
return (
<ViewPicker
table={table}
view={view}
onChange={newView => setView(newView)}
width="320px"
/>
);
};
You can sync that up to globalConfig
, with ViewPickerSynced
:
import React from "react";
import { useBase, ViewPickerSynced } from "@airtable/blocks/ui";
const ViewPickerSyncedExample = () => {
const base = useBase();
const table = base.getTableByNameIfExists("Tasks");
// If table is null or undefined, the ViewPickerSynced will not render.
return (
<ViewPickerSynced table={table} globalConfigKey="viewId" width="320px" />
);
};

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎Sep 09, 2020 10:35 AM
Can I assume that you’re programming this custom Block? If so, then I believe what you’re looking for is ViewPicker
:
import React, { useState } from "react";
import { ViewPicker, useBase } from "@airtable/blocks/ui";
const ViewPickerExample = () => {
const [view, setView] = useState(null);
const base = useBase();
const table = base.getTableByNameIfExists("Tasks");
// If table is null or undefined, the ViewPicker will not render.
return (
<ViewPicker
table={table}
view={view}
onChange={newView => setView(newView)}
width="320px"
/>
);
};
You can sync that up to globalConfig
, with ViewPickerSynced
:
import React from "react";
import { useBase, ViewPickerSynced } from "@airtable/blocks/ui";
const ViewPickerSyncedExample = () => {
const base = useBase();
const table = base.getTableByNameIfExists("Tasks");
// If table is null or undefined, the ViewPickerSynced will not render.
return (
<ViewPickerSynced table={table} globalConfigKey="viewId" width="320px" />
);
};
