question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Enable selector box in the right panel while selecting a particular component on the canvas

See original GitHub issue

When the user click on that component on the canvas, at the same time, we get few setting components like Typography, Margin, Appearance in right panel under Customization. But If I want to show that same name of the draggable component (like ‘Text’ or ‘Container’)that I clicked on the canvas, How can I do that ???

Below is the default code, that is used in order to enable of rendering corresponding setting component of a particular draggable component like Typography, Margin, etc. What I need to add in order to enable a feature so that name of the clicked or selected component appears on the top of right panel. Please help me to enable this feature.

import React from 'react';
import { useEditor } from '@craftjs/core';
export * from './ToolbarItem';
export * from './ToolbarSection';
export * from './ToolbarTextInput';
export * from './ToolbarDropdown';
export * from './ToolbarFontInput';

export const Toolbar = () => {
  const { active, related } = useEditor((state) => ({
    active: state.events.selected,
    related:
      state.events.selected && state.nodes[state.events.selected].related,
  }));

  return (
    <div className="py-0 h-screen">
      {active && related.toolbar && React.createElement(related.toolbar)}
      {!active && (
        <div
          className="px-5 py-2 flex flex-col items-center h-full justify-center text-center"
          style={{
            color: 'rgba(255, 255, 255, 1)',
            fontSize: '11px',
          }}
        >
          <h2 className="pb-1 ">Click on a component to start editing.</h2>
          <h2 className="">
            You could also double click on the layers below to edit their names,
            like in Photoshop
          </h2>
        </div>
      )}
    </div>
  );
};



Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
ankricommented, Aug 13, 2021

What I need to add in order to enable a feature so that name of the clicked or selected component appears on the top of right panel. Please help me to enable this feature.

The top right of which panel? Because in the basic example the component name is displayed in the top right:

image

See: Selected Button on the top right of the SettingsPanel. The corresponding code is here

1reaction
ankricommented, Aug 13, 2021

Hi!

I’m not sure whether I understand you correctly. Do you want to display the component’s name in the Editor/Canvas, like this (ComplexSection)? image Taken from the landing page example from craft.js.org

This is achieved by rendering a floating box in RenderNode.tsx

Read more comments on GitHub >

github_iconTop Results From Across the Web

Design, prototype, and inspect (right sidebar)
When you select a component, you can view, detach, or swap instances in the Instance menu. Any properties that are currently active will...
Read more >
Manage objects with the Selection pane - Microsoft Support
You can launch the Selection pane from the Select item on the Home tab of the ribbon, or by pressing ALT+F10.
Read more >
Illustrator workspace basics - Adobe Support
For example, when you select a text object, the Control panel displays ... In the search box in the upper-right corner of the...
Read more >
Components | Webflow University
Select the component instance. Open the Style, Element settings, or Interactions panels, and click the “Edit component” button to edit the main component....
Read more >
Report and page layout - Looker Studio Help - Google Support
Resize components: while resizing a component, blue lines appear to show when that component is the same length or width as other components...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found