<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: In arcgis-sketch component How to set all availableCreateTools (freehandpolyline, freehandpolygon, text) in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/in-arcgis-sketch-component-how-to-set-all/m-p/1719792#M88590</link>
    <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/349741"&gt;@JoseBanuelos&lt;/a&gt;&amp;nbsp;The text interface also needs a way for the user to change the value of the TextSymbol. It is practically useless without this option. Controls for color, size and other options would also be nice, but are not absolutely necessary.&lt;/P&gt;</description>
    <pubDate>Tue, 11 Aug 2026 12:10:55 GMT</pubDate>
    <dc:creator>JeffreyThompson2</dc:creator>
    <dc:date>2026-08-11T12:10:55Z</dc:date>
    <item>
      <title>In arcgis-sketch component How to set all availableCreateTools (freehandpolyline, freehandpolygon, text)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/in-arcgis-sketch-component-how-to-set-all/m-p/1665068#M87845</link>
      <description>&lt;P&gt;How can I configure all availableCreateTools, such as freehand polyline, freehand polygon, and text?&lt;/P&gt;&lt;P&gt;Currently, I'm able to access all other tools except the three mentioned above.&lt;/P&gt;&lt;P&gt;I followed&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-sketch/#availableCreateTools" target="_blank"&gt;Sketch | ArcGIS Maps SDK for JavaScript&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Below are the details:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ArcGIS Javascript SDK&lt;/STRONG&gt; 4.32.13&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;React&lt;/STRONG&gt; 19.0.0&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;NOTE:&lt;/STRONG&gt; I am not using Typescript. instead, I am writing code in .jsx file.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Case-1: Below is the code snippet being used to initialize the sketch component:&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const sketchElement = sketchRef.current;
            sketchElement.view = mapView;
            sketchElement.availableCreateTools = [
                "point",
                "multipoint",
                "freehandPolyline",   // Not showing
                "polyline",
                "freehandPolygon", // Not showing
                "polygon",
                "rectangle",
                "circle",
                "text" // Not showing
            ];
            sketchElement.layer = sketchLayer;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I’ve also attempted the second approach as outlined below. Case 2: This is the code snippet used to initialize the sketch component.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;&amp;lt;arcgis-sketch
  ref={sketchRef}
  layout="vertical"
  creation-mode="update"
  scale="m"
  toolbar-kind="docked"
  show-create-tools-freehand-polyline
  show-create-tools-freehand-polygon
  
/&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Despite trying both approaches, the freehand polyline, freehand polygon, and text buttons are still not appearing in the Sketch UI. Any insights?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Nov 2025 11:37:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/in-arcgis-sketch-component-how-to-set-all/m-p/1665068#M87845</guid>
      <dc:creator>RavindraSingh</dc:creator>
      <dc:date>2025-11-12T11:37:29Z</dc:date>
    </item>
    <item>
      <title>Re: In arcgis-sketch component How to set all availableCreateTools (freehandpolyline, freehandpolygon, text)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/in-arcgis-sketch-component-how-to-set-all/m-p/1665164#M87846</link>
      <description>&lt;P&gt;If you're using JSX, you probably need to use the the camelCase for attributes.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;showCreateToolsFreehandPolygon&lt;/LI&gt;&lt;LI&gt;showCreateToolsFreehandPolyline&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;However, it does look like the multipoint and text options will not show at the moment. We're looking into this and will have this updated in 5.0.&lt;/P&gt;&lt;P&gt;Ok, small update. I had to set a timeout and the multipoint tool does show up. The text tool does not as that is not quite ready yet.&amp;nbsp;&lt;A href="https://codepen.io/odoe/pen/myPJvgd?editors=1001" target="_blank"&gt;https://codepen.io/odoe/pen/myPJvgd?editors=1001&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Nov 2025 18:09:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/in-arcgis-sketch-component-how-to-set-all/m-p/1665164#M87846</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2025-11-12T18:09:29Z</dc:date>
    </item>
    <item>
      <title>Re: In arcgis-sketch component How to set all availableCreateTools (freehandpolyline, freehandpolygon, text)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/in-arcgis-sketch-component-how-to-set-all/m-p/1665378#M87850</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/7384"&gt;@ReneRubalcava&lt;/a&gt;&amp;nbsp;for response. I tried what you suggest but still freehandpolygon and freehandpolyline is not showing up in UI.&lt;/P&gt;&lt;P&gt;Here is full code of mine, can you have look at it and help to make it run:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;/* eslint-disable react/prop-types */
import React, { useState, useEffect, useRef, useContext, useCallback  } from 'react';
import ReactDOM from 'react-dom';
import { useTheme } from '@mui/material/styles';
import { IconButton, Popper, Box, Typography } from "@mui/material";
import IconMarkup from '../../assets/icons/IconMarkup.svg?react';

import { MapContext } from './Context/MapContext.jsx';
import "@arcgis/map-components/components/arcgis-sketch";
import GraphicsLayer from "@arcgis/core/layers/GraphicsLayer";

// Import the new custom tool
import MarkupCustomTool from './MarkupCustomTool.jsx';

function MarkupTool ({
    containerStyle,
    activeDialog,
    onDialogToggle,
}) {
    const theme = useTheme();
    const dialogId = 'markupDialog';
    const dialogIsOpen = activeDialog === dialogId;

    const [tooltipAnchorEl, setTooltipAnchorEl] = useState(null); 
    const [openPopper, setOpenPopper] = useState(false);
    const id = openPopper ? 'markup-popper' : undefined;
    const [sketchLayer, setSketchLayer] = useState(null);

    const sketchRef = useRef(null);
    const { mapView } = useContext(MapContext);

    // Use useCallback for the ready handler
    const handleSketchReady = useCallback(() =&amp;gt; {
        const sketchElement = document.querySelector("arcgis-sketch");
        if (!sketchElement) {
            console.log("Sketch element not found in handleSketchReady");
            return;
        }

        console.log("✅ Sketch element ready (handleSketchReady fired)");
        
        // Small timeout to ensure the element is fully initialized
        setTimeout(() =&amp;gt; {
            sketchElement.availableCreateTools = [
                "point",
                "multipoint",
                "polyline",
                "freehandPolygon",
                "freehandPolyline",
                "polygon",
                "rectangle",
                "circle",
                "text" // Not showing intentionally for now
            ];
            console.log("Available tools set:", sketchElement.availableCreateTools);
        }, 1000);
    }, []);

    useEffect(() =&amp;gt; {
        if (!mapView) return;

        const layer = new GraphicsLayer({
            id: "markup_graphics_layer",
            title: "Markup Graphics"
        });
        setSketchLayer(layer);

        mapView.map.add(layer);

        return () =&amp;gt; {
            if (mapView &amp;amp;&amp;amp; !mapView.destroyed) {
                mapView.map.remove(layer);
            }
        };
    }, [mapView]);

    const handleButtonClick = () =&amp;gt; {
        onDialogToggle(dialogId);
        setOpenPopper(false); 
        setTooltipAnchorEl(null);
    };

    const handleMouseEnter = (event) =&amp;gt; {
        setTooltipAnchorEl(event.currentTarget);
        if (!dialogIsOpen) {
            setOpenPopper(true);
        }
    };

    const handleMouseLeave = () =&amp;gt; {
        setOpenPopper(false);
        setTooltipAnchorEl(null);
    };

    useEffect(() =&amp;gt; {
        if (dialogIsOpen) {
            setOpenPopper(false);
            setTooltipAnchorEl(null);
        }
    }, [dialogIsOpen]);

    useEffect(() =&amp;gt; {
        if (!dialogIsOpen || !mapView || !sketchLayer) return;

        // Use a slight delay to ensure the element is in the DOM
        const timer = setTimeout(() =&amp;gt; {
            const sketchElement = document.querySelector("arcgis-sketch");
            
            if (!sketchElement) {
                console.log("Sketch element not found");
                return;
            }

            console.log("Setting up sketch element");
            
            // Set view and layer first
            sketchElement.view = mapView;
            sketchElement.layer = sketchLayer;

            // Check if already ready (widget property exists)
            if (sketchElement.widget) {
                console.log("Sketch element already ready");
                handleSketchReady();
            } else {
                console.log("Waiting for arcgisReady event");
                // Add event listener for when it becomes ready
                sketchElement.addEventListener("arcgisReady", handleSketchReady);
            }

            // Cleanup function
            return () =&amp;gt; {
                sketchElement.removeEventListener("arcgisReady", handleSketchReady);
            };
        }, 100);

        return () =&amp;gt; {
            clearTimeout(timer);
        };
    }, [dialogIsOpen, mapView, sketchLayer, handleSketchReady]);


    return (
        &amp;lt;&amp;gt;
            &amp;lt;IconButton
                variant="contained"
                style={containerStyle}
                sx={{
                    width: 48,
                    height: 48,
                    backgroundColor: dialogIsOpen ? theme.appColor.darkGray : theme.appColor.darkGray,
                    color: dialogIsOpen ? theme.appColor.lightBlue: 'white',
                    '&amp;amp;:hover': {
                        backgroundColor: dialogIsOpen ? theme.appColor.darkGray : 'white',
                        color: dialogIsOpen ? theme.appColor.lightBlue : theme.appColor.darkGray,
                    },
                    '&amp;amp;:active': {
                        backgroundColor: dialogIsOpen ? 'white' : 'white',
                        color: dialogIsOpen ? theme.appColor.darkGray : theme.appColor.lightBlue,
                    },
                }}
                onClick={handleButtonClick}
                onMouseEnter={handleMouseEnter}
                onMouseLeave={handleMouseLeave}
                aria-describedby={id}
                aria-label="MarkupButton"
            &amp;gt;
                &amp;lt;IconMarkup alt="Markup" /&amp;gt;
            &amp;lt;/IconButton&amp;gt;

            &amp;lt;Popper
                id={id}
                open={openPopper}
                anchorEl={tooltipAnchorEl}
                placement="left"
                disablePortal={false}
                modifiers={[{ name: 'offset', options: { offset: [0, 10] } }]}
            &amp;gt;
                &amp;lt;Box sx={{
                    border: '#DFDFDF',
                    padding: '12px',
                    bgcolor: 'white',
                    borderRadius: '8px',
                    boxShadow: 3,
                }}&amp;gt;
                    &amp;lt;Typography variant="body2"&amp;gt;Markup Tools&amp;lt;/Typography&amp;gt;
                &amp;lt;/Box&amp;gt;
            &amp;lt;/Popper&amp;gt;

            {dialogIsOpen &amp;amp;&amp;amp; mapView &amp;amp;&amp;amp; mapView.container &amp;amp;&amp;amp; (
                ReactDOM.createPortal(
                    &amp;lt;Box
                        sx={{
                            position: 'absolute',
                            top: 150, 
                            right: 82,
                            backgroundColor: 'white',
                            boxShadow: 3,
                            borderRadius: '8px',
                            zIndex: 1300,
                        }}
                    &amp;gt;
                        &amp;lt;arcgis-sketch
                            ref={sketchRef}
                            layout="vertical"
                            creation-mode="update"
                            scale="m"
                            toolbar-kind="docked"
                            hide-selection-tools-lasso-selection
                            show-create-tools-freehand-polygon
                            show-create-tools-freehand-polyline
                            showCreateToolsFreehandPolyline
                        /&amp;gt;
                        &amp;lt;MarkupCustomTool
                            sketchLayer={sketchLayer}
                            sketchRef={sketchRef}
                            dialogIsOpen={dialogIsOpen}
                        /&amp;gt;
                    &amp;lt;/Box&amp;gt;,
                    mapView.container
                )
            )}
        &amp;lt;/&amp;gt;
    );
}

export default MarkupTool;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Nov 2025 07:00:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/in-arcgis-sketch-component-how-to-set-all/m-p/1665378#M87850</guid>
      <dc:creator>RavindraSingh</dc:creator>
      <dc:date>2025-11-13T07:00:57Z</dc:date>
    </item>
    <item>
      <title>Re: In arcgis-sketch component How to set all availableCreateTools (freehandpolyline, freehandpolygon, text)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/in-arcgis-sketch-component-how-to-set-all/m-p/1714434#M88550</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/7384"&gt;@ReneRubalcava&lt;/a&gt;&amp;nbsp;Is there any way we can get a status update on the text functionality in the Sketch component? The `show-create-tools-text` attribute is in the documentation but doesn't seem to work yet.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jul 2026 15:57:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/in-arcgis-sketch-component-how-to-set-all/m-p/1714434#M88550</guid>
      <dc:creator>fdeters</dc:creator>
      <dc:date>2026-07-14T15:57:23Z</dc:date>
    </item>
    <item>
      <title>Re: In arcgis-sketch component How to set all availableCreateTools (freehandpolyline, freehandpolygon, text)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/in-arcgis-sketch-component-how-to-set-all/m-p/1719606#M88587</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/7384"&gt;@ReneRubalcava&lt;/a&gt;&amp;nbsp;Tools that are known not to work should not be documented as if they do.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Aug 2026 16:24:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/in-arcgis-sketch-component-how-to-set-all/m-p/1719606#M88587</guid>
      <dc:creator>JeffreyThompson2</dc:creator>
      <dc:date>2026-08-10T16:24:41Z</dc:date>
    </item>
    <item>
      <title>Re: In arcgis-sketch component How to set all availableCreateTools (freehandpolyline, freehandpolygon, text)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/in-arcgis-sketch-component-how-to-set-all/m-p/1719730#M88588</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;In order to display the FreehandPolyline, FreehandPolygon, and Text create tools in &amp;lt;arcgis-sketch /&amp;gt;, you need to set the `availableCreateTools` and the following props:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;`show-create-tools-freehand-polygon`&lt;/LI&gt;&lt;LI&gt;`show-create-tools-freehand-polyline&lt;/LI&gt;&lt;LI&gt;`show-create-tools-text`&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Here is a test app to show this:&amp;nbsp;&lt;A href="https://codepen.io/banuelosj/pen/wBgZoLL?editors=1000" target="_blank"&gt;https://codepen.io/banuelosj/pen/wBgZoLL?editors=1000&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Note: The freehand tools will display with the segment tools for lines and polygons. So you need to select the line or polygon tools first to see the freehand line segments.&lt;/P&gt;&lt;P&gt;We are working on improving the documentation for the text create tool this release, and then in the near future the entire API for setting your create tools. We understand that the requirement to view these tools is to set props in 2 places. AvailableCreateTools and their corresponding props. This is not a good API, so we are working on improving this where you only have to worry about setting the create tools in one place to use them in Sketch.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Jose&lt;/P&gt;</description>
      <pubDate>Mon, 10 Aug 2026 23:35:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/in-arcgis-sketch-component-how-to-set-all/m-p/1719730#M88588</guid>
      <dc:creator>JoseBanuelos</dc:creator>
      <dc:date>2026-08-10T23:35:30Z</dc:date>
    </item>
    <item>
      <title>Re: In arcgis-sketch component How to set all availableCreateTools (freehandpolyline, freehandpolygon, text)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/in-arcgis-sketch-component-how-to-set-all/m-p/1719792#M88590</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/349741"&gt;@JoseBanuelos&lt;/a&gt;&amp;nbsp;The text interface also needs a way for the user to change the value of the TextSymbol. It is practically useless without this option. Controls for color, size and other options would also be nice, but are not absolutely necessary.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Aug 2026 12:10:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/in-arcgis-sketch-component-how-to-set-all/m-p/1719792#M88590</guid>
      <dc:creator>JeffreyThompson2</dc:creator>
      <dc:date>2026-08-11T12:10:55Z</dc:date>
    </item>
  </channel>
</rss>

