Skip to content

add hybrid panel example#275

Open
imanjra wants to merge 1 commit intomainfrom
feat/hybrid-panel-example
Open

add hybrid panel example#275
imanjra wants to merge 1 commit intomainfrom
feat/hybrid-panel-example

Conversation

@imanjra
Copy link
Contributor

@imanjra imanjra commented Nov 18, 2025

Add an example plugin with a sample hybrid panel

@imanjra imanjra marked this pull request as ready for review November 21, 2025 18:19
@imanjra imanjra force-pushed the feat/hybrid-panel-example branch from 3be031c to a012304 Compare November 24, 2025 15:36
Copy link
Member

@AdonaiVera AdonaiVera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @imanjra,

I left a few suggestions. Sorry if I went a bit deep, but I think this will be one of the main reference examples for hybrid panels, so it felt worth being extra careful. Let me know what you think and I can do a final pass after. Thanks!

# Utilities


def is_fibonacci(n):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is never used, we can remove it to avoid confusing users.

return get_fibonacci_number(n - 1) + get_fibonacci_number(n - 2)


def get_fibonacci_sequence(n):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is not using either, we can remove to clean the example

|
"""

# from .py.sample_auditing_panel import SampleAuditingPanel
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove this import if its not use it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m not sure we’re going to use this file in the example, since the import is commented out, if not we can remove this file

const panelState = usePanelStatePartial("state", {});
const panelData = usePanelStatePartial("data", {}, true);

console.log(">>>", panelState, panelData);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove this console log for the final example

import { PluginComponentType, registerComponent } from "@fiftyone/plugins";
import { useCallback, useState } from "react";
import { useTriggerPanelEvent } from "@fiftyone/operators";
import { usePanelState, usePanelStatePartial } from "@fiftyone/spaces";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove the usePanelState

the backbone of the panel’s logic flow, ensuring that user actions and
application state stay in sync across Python and React.

### Python: Defining amd providing panel event to custom view
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### Python: Defining amd providing panel event to custom view
### Python: Defining and providing panel event to custom view


def increment(self, ctx):
count = ctx.panel.get_state("count")
if count is None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if count is None
if count is None:

version: 1.0.0
fiftyone:
version: "*"
url: https://github.com/voxel51/fiftyone-plugins
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
url: https://github.com/voxel51/fiftyone-plugins
url: https://github.com/voxel51/fiftyone-plugins/tree/main/plugins/hybrid-panel

Comment on lines +280 to +288
return (
<Stack direction="row" spacing={1}>
<Typography>{count}</Typography>
<Button onClick={() => {
handleIncrement()
handleSetDoubleCount()
}}>
</Stack>;
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return (
<Stack direction="row" spacing={1}>
<Typography>{count}</Typography>
<Button onClick={() => {
handleIncrement()
handleSetDoubleCount()
}}>
</Stack>;
)
return (
<Stack direction="row" spacing={1}>
<Typography>{count}</Typography>
<Button onClick={() => {
handleIncrement()
handleSetDoubleCount()
}}>
Increment
</Button>
</Stack>
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants