Quick start
Embed FeedbackDialog and ThumbsFeedback in a React app.
Quick start
Wrap your product UI in DeckProvider, then mount built-in widgets or your own form.
import { useState } from "react";
import {
DeckProvider,
FeedbackDialog,
ThumbsFeedback,
} from "@deck-io/feedback";
function App() {
return (
<DeckProvider
publishableKey={process.env.NEXT_PUBLIC_DECK_PUBLISHABLE_KEY!}
user={{
id: currentUser.id,
email: currentUser.email,
name: currentUser.name,
}}
>
<ProductUi />
</DeckProvider>
);
}
function ProductUi() {
const [open, setOpen] = useState(false);
return (
<>
{/* You own the trigger button */}
<button type="button" onClick={() => setOpen(true)}>
Share feedback
</button>
<FeedbackDialog
widgetId="wgt_your_widget_id"
open={open}
onOpenChange={setOpen}
context={{ surface: "settings" }}
/>
{/* Built-in thumbs; opens the dialog with sentiment pre-set */}
<ThumbsFeedback
widgetId="wgt_your_widget_id"
context={{ messageId: "msg_123" }}
/>
</>
);
}Replace:
wgt_your_widget_idwith the ID from Manage → WidgetscurrentUser.*with your authenticated user fieldsNEXT_PUBLIC_DECK_PUBLISHABLE_KEYwith your env name if needed
Minimal checklist
-
@deck-io/feedbackinstalled -
DeckProvidernear the root of the feature (or app) -
user.idis a stable product user id -
widgetIdmatches a widget in the same org as the publishable key - Publishable key is a
pk_…value (neverdk_…)
Server-side (optional)
To submit from Route Handlers, Server Actions, or workers without React, use the server entry instead of (or in addition to) the UI above:
import { createDeckFeedbackClient } from "@deck-io/feedback/server";
const deck = createDeckFeedbackClient({
publishableKey: process.env.DECK_PUBLISHABLE_KEY!,
});
await deck.submit({
user: { id: session.userId, email: session.email },
submission: {
widgetId: "wgt_your_widget_id",
sentiment: "negative",
message: "Checkout failed after payment",
},
});See Server-side submit.
What to explore next
| Goal | Guide |
|---|---|
| All provider props | DeckProvider |
| Dialog and thumbs props | Components |
| Custom UI only | Headless |
| Node / Next.js server | Server-side |
| Contact matching | Identity and context |